Skip to content

Commit 76aafd7

Browse files
release: 3.0.0 (#39)
1 parent 21e7aae commit 76aafd7

File tree

8 files changed

+33
-73
lines changed

8 files changed

+33
-73
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "3.0.0-beta.6"
2+
".": "3.0.0"
33
}

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Changelog
22

3+
## 3.0.0 (2025-09-18)
4+
5+
Full Changelog: [v3.0.0-beta.6...v3.0.0](https://github.com/digitalocean/gradient-python/compare/v3.0.0-beta.6...v3.0.0)
6+
7+
### Chores
8+
9+
* remove deprecated env vars ([#50](https://github.com/digitalocean/gradient-python/issues/50)) ([32292f5](https://github.com/digitalocean/gradient-python/commit/32292f5d7cab21cfaa68577a6f838d134842e3fc))
10+
* remove old folders ([60545d7](https://github.com/digitalocean/gradient-python/commit/60545d7857d8c78c23fba888cc5eae29330eb521))
11+
* update author ([695cc57](https://github.com/digitalocean/gradient-python/commit/695cc572e7f506617b1a37ed600f4e485dbe26c0))
12+
13+
14+
### Refactors
15+
16+
* **api:** consistently rename user_agent parameter to user_agent_package in Gradient and AsyncGradient classes for clarity ([af7420c](https://github.com/digitalocean/gradient-python/commit/af7420c654bd30af4e30a939e31960ba6414adb7))
17+
* **api:** rename user_agent parameter to user_agent_package in BaseClient, SyncAPIClient, and AsyncAPIClient for better clarity ([dba36f7](https://github.com/digitalocean/gradient-python/commit/dba36f7bae0b3d28a0013f5d23c482b7be5e238a))
18+
319
## 3.0.0-beta.6 (2025-09-17)
420

521
Full Changelog: [v3.0.0-beta.5...v3.0.0-beta.6](https://github.com/digitalocean/gradient-python/compare/v3.0.0-beta.5...v3.0.0-beta.6)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The full API of this library can be found in [api.md](api.md).
2727

2828
```sh
2929
# install from PyPI
30-
pip install --pre gradient
30+
pip install gradient
3131
```
3232

3333
## Usage
@@ -141,7 +141,7 @@ You can enable this by installing `aiohttp`:
141141

142142
```sh
143143
# install from PyPI
144-
pip install --pre gradient[aiohttp]
144+
pip install gradient[aiohttp]
145145
```
146146

147147
Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "gradient"
3-
version = "3.0.0-beta.6"
3+
version = "3.0.0"
44
description = "The official Python library for the Gradient API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"

src/do_gradientai/lib/.keep

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/gradient/_client.py

Lines changed: 12 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ class Gradient(SyncAPIClient):
8080
def __init__(
8181
self,
8282
*,
83-
api_key: str | None = None, # deprecated, use `access_token` instead
84-
inference_key: str | None = None, # deprecated, use `model_access_key` instead
85-
agent_key: str | None = None, # deprecated, use `agent_access_key` instead
8683
access_token: str | None = None,
8784
model_access_key: str | None = None,
8885
agent_access_key: str | None = None,
@@ -120,33 +117,15 @@ def __init__(
120117
- `inference_endpoint` from `GRADIENT_INFERENCE_ENDPOINT`
121118
"""
122119
if access_token is None:
123-
if api_key is not None:
124-
access_token = api_key
125-
else:
126-
access_token = os.environ.get("DIGITALOCEAN_ACCESS_TOKEN")
127-
# support for legacy environment variable
128-
if access_token is None:
129-
access_token = os.environ.get("GRADIENT_API_KEY")
120+
access_token = os.environ.get("DIGITALOCEAN_ACCESS_TOKEN")
130121
self.access_token = access_token
131122

132123
if model_access_key is None:
133-
if inference_key is not None:
134-
model_access_key = inference_key
135-
else:
136-
model_access_key = os.environ.get("GRADIENT_INFERENCE_KEY")
137-
# support for legacy environment variable
138-
if model_access_key is None:
139-
model_access_key = os.environ.get("GRADIENT_MODEL_ACCESS_KEY")
124+
model_access_key = os.environ.get("GRADIENT_MODEL_ACCESS_KEY")
140125
self.model_access_key = model_access_key
141126

142127
if agent_access_key is None:
143-
if agent_key is not None:
144-
agent_access_key = agent_key
145-
else:
146-
agent_access_key = os.environ.get("GRADIENT_AGENT_ACCESS_KEY")
147-
# support for legacy environment variable
148-
if agent_access_key is None:
149-
agent_access_key = os.environ.get("GRADIENT_AGENT_KEY")
128+
agent_access_key = os.environ.get("GRADIENT_AGENT_ACCESS_KEY")
150129
self.agent_access_key = agent_access_key
151130

152131
if agent_endpoint is None:
@@ -283,9 +262,6 @@ def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None:
283262
def copy(
284263
self,
285264
*,
286-
api_key: str | None = None, # deprecated, use `access_token` instead
287-
inference_key: str | None = None, # deprecated, use `model_access_key` instead
288-
agent_key: str | None = None, # deprecated, use `agent_access_key` instead
289265
access_token: str | None = None,
290266
model_access_key: str | None = None,
291267
agent_access_key: str | None = None,
@@ -326,9 +302,9 @@ def copy(
326302

327303
http_client = http_client or self._client
328304
client = self.__class__(
329-
access_token=access_token or api_key or self.access_token,
330-
model_access_key=model_access_key or inference_key or self.model_access_key,
331-
agent_access_key=agent_access_key or agent_key or self.agent_access_key,
305+
access_token=access_token or self.access_token,
306+
model_access_key=model_access_key or self.model_access_key,
307+
agent_access_key=agent_access_key or self.agent_access_key,
332308
agent_endpoint=agent_endpoint or self._agent_endpoint,
333309
inference_endpoint=inference_endpoint or self.inference_endpoint,
334310
base_url=base_url or self.base_url,
@@ -393,9 +369,6 @@ class AsyncGradient(AsyncAPIClient):
393369
def __init__(
394370
self,
395371
*,
396-
api_key: str | None = None, # deprecated, use `access_token` instead
397-
inference_key: str | None = None, # deprecated, use `model_access_key` instead
398-
agent_key: str | None = None, # deprecated, use `agent_access_key` instead
399372
access_token: str | None = None,
400373
model_access_key: str | None = None,
401374
agent_access_key: str | None = None,
@@ -433,33 +406,15 @@ def __init__(
433406
- `inference_endpoint` from `GRADIENT_INFERENCE_ENDPOINT`
434407
"""
435408
if access_token is None:
436-
if api_key is not None:
437-
access_token = api_key
438-
else:
439-
access_token = os.environ.get("DIGITALOCEAN_ACCESS_TOKEN")
440-
# support for legacy environment variable
441-
if access_token is None:
442-
access_token = os.environ.get("GRADIENT_API_KEY")
409+
access_token = os.environ.get("DIGITALOCEAN_ACCESS_TOKEN")
443410
self.access_token = access_token
444411

445412
if model_access_key is None:
446-
if inference_key is not None:
447-
model_access_key = inference_key
448-
else:
449-
model_access_key = os.environ.get("GRADIENT_INFERENCE_KEY")
450-
# support for legacy environment variable
451-
if model_access_key is None:
452-
model_access_key = os.environ.get("GRADIENT_MODEL_ACCESS_KEY")
413+
model_access_key = os.environ.get("GRADIENT_MODEL_ACCESS_KEY")
453414
self.model_access_key = model_access_key
454415

455416
if agent_access_key is None:
456-
if agent_key is not None:
457-
agent_access_key = agent_key
458-
else:
459-
agent_access_key = os.environ.get("GRADIENT_AGENT_ACCESS_KEY")
460-
# support for legacy environment variable
461-
if agent_access_key is None:
462-
agent_access_key = os.environ.get("GRADIENT_AGENT_KEY")
417+
agent_access_key = os.environ.get("GRADIENT_AGENT_ACCESS_KEY")
463418
self.agent_access_key = agent_access_key
464419

465420
if agent_endpoint is None:
@@ -596,9 +551,6 @@ def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None:
596551
def copy(
597552
self,
598553
*,
599-
api_key: str | None = None, # deprecated, use `access_token` instead
600-
inference_key: str | None = None, # deprecated, use `model_access_key` instead
601-
agent_key: str | None = None, # deprecated, use `agent_access_key` instead
602554
agent_endpoint: str | None = None,
603555
access_token: str | None = None,
604556
model_access_key: str | None = None,
@@ -639,9 +591,9 @@ def copy(
639591

640592
http_client = http_client or self._client
641593
client = self.__class__(
642-
access_token=access_token or api_key or self.access_token,
643-
model_access_key=model_access_key or inference_key or self.model_access_key,
644-
agent_access_key=agent_access_key or agent_key or self.agent_access_key,
594+
access_token=access_token or self.access_token,
595+
model_access_key=model_access_key or self.model_access_key,
596+
agent_access_key=agent_access_key or self.agent_access_key,
645597
agent_endpoint=agent_endpoint or self._agent_endpoint,
646598
inference_endpoint=inference_endpoint or self.inference_endpoint,
647599
base_url=base_url or self.base_url,

src/gradient/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "gradient"
4-
__version__ = "3.0.0-beta.6" # x-release-please-version
4+
__version__ = "3.0.0" # x-release-please-version

src/gradientai/lib/.keep

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)