diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 3c4dbee7..4191c889 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "3.0.0-beta.6" + ".": "3.0.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d1760d0..86e65d8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## 3.0.0 (2025-09-18) + +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) + +### Chores + +* remove deprecated env vars ([#50](https://github.com/digitalocean/gradient-python/issues/50)) ([32292f5](https://github.com/digitalocean/gradient-python/commit/32292f5d7cab21cfaa68577a6f838d134842e3fc)) +* remove old folders ([60545d7](https://github.com/digitalocean/gradient-python/commit/60545d7857d8c78c23fba888cc5eae29330eb521)) +* update author ([695cc57](https://github.com/digitalocean/gradient-python/commit/695cc572e7f506617b1a37ed600f4e485dbe26c0)) + + +### Refactors + +* **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)) +* **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)) + ## 3.0.0-beta.6 (2025-09-17) 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) diff --git a/README.md b/README.md index 3e32f833..a7b92030 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ The full API of this library can be found in [api.md](api.md). ```sh # install from PyPI -pip install --pre gradient +pip install gradient ``` ## Usage @@ -141,7 +141,7 @@ You can enable this by installing `aiohttp`: ```sh # install from PyPI -pip install --pre gradient[aiohttp] +pip install gradient[aiohttp] ``` Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`: diff --git a/pyproject.toml b/pyproject.toml index 31b6bcf2..859b32e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "gradient" -version = "3.0.0-beta.6" +version = "3.0.0" description = "The official Python library for the Gradient API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/do_gradientai/lib/.keep b/src/do_gradientai/lib/.keep deleted file mode 100644 index 5e2c99fd..00000000 --- a/src/do_gradientai/lib/.keep +++ /dev/null @@ -1,4 +0,0 @@ -File generated from our OpenAPI spec by Stainless. - -This directory can be used to store custom files to expand the SDK. -It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. \ No newline at end of file diff --git a/src/gradient/_client.py b/src/gradient/_client.py index a809e56b..a50c26cf 100644 --- a/src/gradient/_client.py +++ b/src/gradient/_client.py @@ -80,9 +80,6 @@ class Gradient(SyncAPIClient): def __init__( self, *, - api_key: str | None = None, # deprecated, use `access_token` instead - inference_key: str | None = None, # deprecated, use `model_access_key` instead - agent_key: str | None = None, # deprecated, use `agent_access_key` instead access_token: str | None = None, model_access_key: str | None = None, agent_access_key: str | None = None, @@ -120,33 +117,15 @@ def __init__( - `inference_endpoint` from `GRADIENT_INFERENCE_ENDPOINT` """ if access_token is None: - if api_key is not None: - access_token = api_key - else: - access_token = os.environ.get("DIGITALOCEAN_ACCESS_TOKEN") - # support for legacy environment variable - if access_token is None: - access_token = os.environ.get("GRADIENT_API_KEY") + access_token = os.environ.get("DIGITALOCEAN_ACCESS_TOKEN") self.access_token = access_token if model_access_key is None: - if inference_key is not None: - model_access_key = inference_key - else: - model_access_key = os.environ.get("GRADIENT_INFERENCE_KEY") - # support for legacy environment variable - if model_access_key is None: - model_access_key = os.environ.get("GRADIENT_MODEL_ACCESS_KEY") + model_access_key = os.environ.get("GRADIENT_MODEL_ACCESS_KEY") self.model_access_key = model_access_key if agent_access_key is None: - if agent_key is not None: - agent_access_key = agent_key - else: - agent_access_key = os.environ.get("GRADIENT_AGENT_ACCESS_KEY") - # support for legacy environment variable - if agent_access_key is None: - agent_access_key = os.environ.get("GRADIENT_AGENT_KEY") + agent_access_key = os.environ.get("GRADIENT_AGENT_ACCESS_KEY") self.agent_access_key = agent_access_key if agent_endpoint is None: @@ -283,9 +262,6 @@ def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None: def copy( self, *, - api_key: str | None = None, # deprecated, use `access_token` instead - inference_key: str | None = None, # deprecated, use `model_access_key` instead - agent_key: str | None = None, # deprecated, use `agent_access_key` instead access_token: str | None = None, model_access_key: str | None = None, agent_access_key: str | None = None, @@ -326,9 +302,9 @@ def copy( http_client = http_client or self._client client = self.__class__( - access_token=access_token or api_key or self.access_token, - model_access_key=model_access_key or inference_key or self.model_access_key, - agent_access_key=agent_access_key or agent_key or self.agent_access_key, + access_token=access_token or self.access_token, + model_access_key=model_access_key or self.model_access_key, + agent_access_key=agent_access_key or self.agent_access_key, agent_endpoint=agent_endpoint or self._agent_endpoint, inference_endpoint=inference_endpoint or self.inference_endpoint, base_url=base_url or self.base_url, @@ -393,9 +369,6 @@ class AsyncGradient(AsyncAPIClient): def __init__( self, *, - api_key: str | None = None, # deprecated, use `access_token` instead - inference_key: str | None = None, # deprecated, use `model_access_key` instead - agent_key: str | None = None, # deprecated, use `agent_access_key` instead access_token: str | None = None, model_access_key: str | None = None, agent_access_key: str | None = None, @@ -433,33 +406,15 @@ def __init__( - `inference_endpoint` from `GRADIENT_INFERENCE_ENDPOINT` """ if access_token is None: - if api_key is not None: - access_token = api_key - else: - access_token = os.environ.get("DIGITALOCEAN_ACCESS_TOKEN") - # support for legacy environment variable - if access_token is None: - access_token = os.environ.get("GRADIENT_API_KEY") + access_token = os.environ.get("DIGITALOCEAN_ACCESS_TOKEN") self.access_token = access_token if model_access_key is None: - if inference_key is not None: - model_access_key = inference_key - else: - model_access_key = os.environ.get("GRADIENT_INFERENCE_KEY") - # support for legacy environment variable - if model_access_key is None: - model_access_key = os.environ.get("GRADIENT_MODEL_ACCESS_KEY") + model_access_key = os.environ.get("GRADIENT_MODEL_ACCESS_KEY") self.model_access_key = model_access_key if agent_access_key is None: - if agent_key is not None: - agent_access_key = agent_key - else: - agent_access_key = os.environ.get("GRADIENT_AGENT_ACCESS_KEY") - # support for legacy environment variable - if agent_access_key is None: - agent_access_key = os.environ.get("GRADIENT_AGENT_KEY") + agent_access_key = os.environ.get("GRADIENT_AGENT_ACCESS_KEY") self.agent_access_key = agent_access_key if agent_endpoint is None: @@ -596,9 +551,6 @@ def _validate_headers(self, headers: Headers, custom_headers: Headers) -> None: def copy( self, *, - api_key: str | None = None, # deprecated, use `access_token` instead - inference_key: str | None = None, # deprecated, use `model_access_key` instead - agent_key: str | None = None, # deprecated, use `agent_access_key` instead agent_endpoint: str | None = None, access_token: str | None = None, model_access_key: str | None = None, @@ -639,9 +591,9 @@ def copy( http_client = http_client or self._client client = self.__class__( - access_token=access_token or api_key or self.access_token, - model_access_key=model_access_key or inference_key or self.model_access_key, - agent_access_key=agent_access_key or agent_key or self.agent_access_key, + access_token=access_token or self.access_token, + model_access_key=model_access_key or self.model_access_key, + agent_access_key=agent_access_key or self.agent_access_key, agent_endpoint=agent_endpoint or self._agent_endpoint, inference_endpoint=inference_endpoint or self.inference_endpoint, base_url=base_url or self.base_url, diff --git a/src/gradient/_version.py b/src/gradient/_version.py index 81080cc3..17f05c22 100644 --- a/src/gradient/_version.py +++ b/src/gradient/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "gradient" -__version__ = "3.0.0-beta.6" # x-release-please-version +__version__ = "3.0.0" # x-release-please-version diff --git a/src/gradientai/lib/.keep b/src/gradientai/lib/.keep deleted file mode 100644 index 5e2c99fd..00000000 --- a/src/gradientai/lib/.keep +++ /dev/null @@ -1,4 +0,0 @@ -File generated from our OpenAPI spec by Stainless. - -This directory can be used to store custom files to expand the SDK. -It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. \ No newline at end of file