diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 565ec95e..e503784c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,6 @@ jobs: lint: name: lint runs-on: ubuntu-latest - steps: - uses: actions/checkout@v4 @@ -30,5 +29,3 @@ jobs: - name: Run lints run: ./scripts/lint - - diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e8285b71..4f9005ea 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.5" + ".": "0.1.0-alpha.6" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e50bc046..bf27a6b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 0.1.0-alpha.6 (2025-01-24) + +Full Changelog: [v0.1.0-alpha.5...v0.1.0-alpha.6](https://github.com/cleanlab/codex-python/compare/v0.1.0-alpha.5...v0.1.0-alpha.6) + +### Features + +* **api:** manual updates ([#38](https://github.com/cleanlab/codex-python/issues/38)) ([19d1564](https://github.com/cleanlab/codex-python/commit/19d15642892532a695756459c8fadd10bff2d5f0)) + + +### Chores + +* **internal:** minor formatting changes ([#37](https://github.com/cleanlab/codex-python/issues/37)) ([39c096c](https://github.com/cleanlab/codex-python/commit/39c096c71a77a0db1b4e546932304eb745a535ca)) +* **internal:** minor style changes ([#35](https://github.com/cleanlab/codex-python/issues/35)) ([8aa2b96](https://github.com/cleanlab/codex-python/commit/8aa2b96246c7a9a95c6a0de6c317f8a38581fee4)) + ## 0.1.0-alpha.5 (2025-01-22) Full Changelog: [v0.1.0-alpha.4...v0.1.0-alpha.5](https://github.com/cleanlab/codex-python/compare/v0.1.0-alpha.4...v0.1.0-alpha.5) diff --git a/README.md b/README.md index 7b5fda1d..56bc216a 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ print(project_return_schema.id) While you can provide a `bearer_token` keyword argument, we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/) -to add `BEARER_TOKEN="My Bearer Token"` to your `.env` file +to add `CODEX_BEARER_TOKEN="My Bearer Token"` to your `.env` file so that your Bearer Token is not stored in source control. ## Async usage diff --git a/pyproject.toml b/pyproject.toml index 1992774e..309b3375 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "codex-sdk" -version = "0.1.0-alpha.5" +version = "0.1.0-alpha.6" description = "The official Python library for the Codex API" dynamic = ["readme"] license = "MIT" diff --git a/scripts/bootstrap b/scripts/bootstrap index 8c5c60eb..e84fe62c 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -4,7 +4,7 @@ set -e cd "$(dirname "$0")/.." -if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then +if ! command -v rye >/dev/null 2>&1 && [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then brew bundle check >/dev/null 2>&1 || { echo "==> Installing Homebrew dependencies…" brew bundle diff --git a/scripts/lint b/scripts/lint index 6f2bb0d0..adfc6acf 100755 --- a/scripts/lint +++ b/scripts/lint @@ -9,4 +9,3 @@ rye run lint echo "==> Making sure it imports" rye run python -c 'import codex' - diff --git a/src/codex/_client.py b/src/codex/_client.py index 74f0c871..fc0c27bf 100644 --- a/src/codex/_client.py +++ b/src/codex/_client.py @@ -100,20 +100,20 @@ def __init__( """Construct a new synchronous Codex client instance. This automatically infers the following arguments from their corresponding environment variables if they are not provided: - - `bearer_token` from `BEARER_TOKEN` - - `api_key` from `AUTHENTICATED_API_KEY` - - `access_key` from `PUBLIC_ACCESS_KEY` + - `bearer_token` from `CODEX_BEARER_TOKEN` + - `api_key` from `CODEX_API_KEY` + - `access_key` from `CODEX_ACCESS_KEY` """ if bearer_token is None: - bearer_token = os.environ.get("BEARER_TOKEN") + bearer_token = os.environ.get("CODEX_BEARER_TOKEN") self.bearer_token = bearer_token if api_key is None: - api_key = os.environ.get("AUTHENTICATED_API_KEY") + api_key = os.environ.get("CODEX_API_KEY") self.api_key = api_key if access_key is None: - access_key = os.environ.get("PUBLIC_ACCESS_KEY") + access_key = os.environ.get("CODEX_ACCESS_KEY") self.access_key = access_key self._environment = environment @@ -362,20 +362,20 @@ def __init__( """Construct a new async Codex client instance. This automatically infers the following arguments from their corresponding environment variables if they are not provided: - - `bearer_token` from `BEARER_TOKEN` - - `api_key` from `AUTHENTICATED_API_KEY` - - `access_key` from `PUBLIC_ACCESS_KEY` + - `bearer_token` from `CODEX_BEARER_TOKEN` + - `api_key` from `CODEX_API_KEY` + - `access_key` from `CODEX_ACCESS_KEY` """ if bearer_token is None: - bearer_token = os.environ.get("BEARER_TOKEN") + bearer_token = os.environ.get("CODEX_BEARER_TOKEN") self.bearer_token = bearer_token if api_key is None: - api_key = os.environ.get("AUTHENTICATED_API_KEY") + api_key = os.environ.get("CODEX_API_KEY") self.api_key = api_key if access_key is None: - access_key = os.environ.get("PUBLIC_ACCESS_KEY") + access_key = os.environ.get("CODEX_ACCESS_KEY") self.access_key = access_key self._environment = environment diff --git a/src/codex/_response.py b/src/codex/_response.py index 174baacd..6e7c1cdf 100644 --- a/src/codex/_response.py +++ b/src/codex/_response.py @@ -136,6 +136,8 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: if cast_to and is_annotated_type(cast_to): cast_to = extract_type_arg(cast_to, 0) + origin = get_origin(cast_to) or cast_to + if self._is_sse_stream: if to: if not is_stream_class_type(to): @@ -195,8 +197,6 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: if cast_to == bool: return cast(R, response.text.lower() == "true") - origin = get_origin(cast_to) or cast_to - if origin == APIResponse: raise RuntimeError("Unexpected state - cast_to is `APIResponse`") diff --git a/src/codex/_version.py b/src/codex/_version.py index 134b2cab..559cb92d 100644 --- a/src/codex/_version.py +++ b/src/codex/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "codex" -__version__ = "0.1.0-alpha.5" # x-release-please-version +__version__ = "0.1.0-alpha.6" # x-release-please-version