Skip to content

Commit 4157586

Browse files
release: 0.1.0-alpha.20 (#117)
* chore(internal): version bump * codegen metadata * chore(internal): avoid errors for isinstance checks on proxies * fix(package): support direct resource imports * codegen metadata * codegen metadata * feat(api): api update * feat(api): api update * chore(ci): upload sdks to package manager * release: 0.1.0-alpha.20 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 0689f69 commit 4157586

File tree

18 files changed

+161
-45
lines changed

18 files changed

+161
-45
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,27 @@ jobs:
2929

3030
- name: Run lints
3131
run: ./scripts/lint
32+
33+
upload:
34+
if: github.repository == 'stainless-sdks/codex-python'
35+
timeout-minutes: 10
36+
name: upload
37+
permissions:
38+
contents: read
39+
id-token: write
40+
runs-on: depot-ubuntu-24.04
41+
steps:
42+
- uses: actions/checkout@v4
43+
44+
- name: Get GitHub OIDC Token
45+
id: github-oidc
46+
uses: actions/github-script@v6
47+
with:
48+
script: core.setOutput('github_token', await core.getIDToken());
49+
50+
- name: Upload tarball
51+
env:
52+
URL: https://pkg.stainless.com/s
53+
AUTH: ${{ steps.github-oidc.outputs.github_token }}
54+
SHA: ${{ github.sha }}
55+
run: ./scripts/utils/upload-artifact.sh

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.1.0-alpha.19"
2+
".": "0.1.0-alpha.20"
33
}

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
configured_endpoints: 44
2-
openapi_spec_hash: 97719fe7ae4c641a5a020dd21f2978dd
2+
openapi_spec_hash: 9d81a4b0eca6d3629ba9d5432a65655c
33
config_hash: 659f65b6ccf5612986f920f7f9abbcb5

CHANGELOG.md

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

3+
## 0.1.0-alpha.20 (2025-05-15)
4+
5+
Full Changelog: [v0.1.0-alpha.19...v0.1.0-alpha.20](https://github.com/cleanlab/codex-python/compare/v0.1.0-alpha.19...v0.1.0-alpha.20)
6+
7+
### Features
8+
9+
* **api:** api update ([2e74162](https://github.com/cleanlab/codex-python/commit/2e741628a380d0fefe117f80bb3796b111575df3))
10+
* **api:** api update ([9e85827](https://github.com/cleanlab/codex-python/commit/9e85827e0b1a58011a8ead15c695cb175744325a))
11+
12+
13+
### Bug Fixes
14+
15+
* **package:** support direct resource imports ([09066c8](https://github.com/cleanlab/codex-python/commit/09066c8bf38b23fd3d902b42c4f4f769161b0e2e))
16+
17+
18+
### Chores
19+
20+
* **ci:** upload sdks to package manager ([6594b48](https://github.com/cleanlab/codex-python/commit/6594b48736ea79e7f9457cb3b47abfa17618565b))
21+
* **internal:** avoid errors for isinstance checks on proxies ([a1d7faf](https://github.com/cleanlab/codex-python/commit/a1d7fafa46e9100a4d29c46b48919025b26a0cfa))
22+
* **internal:** version bump ([971e28d](https://github.com/cleanlab/codex-python/commit/971e28dd483b3f2d38094f368baebd5eb0906e2c))
23+
324
## 0.1.0-alpha.19 (2025-05-07)
425

526
Full Changelog: [v0.1.0-alpha.18...v0.1.0-alpha.19](https://github.com/cleanlab/codex-python/compare/v0.1.0-alpha.18...v0.1.0-alpha.19)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "codex-sdk"
3-
version = "0.1.0-alpha.19"
3+
version = "0.1.0-alpha.20"
44
description = "Internal SDK used within cleanlab-codex package. Refer to https://pypi.org/project/cleanlab-codex/ instead."
55
dynamic = ["readme"]
66
license = "MIT"

scripts/utils/upload-artifact.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env bash
2+
set -exuo pipefail
3+
4+
RESPONSE=$(curl -X POST "$URL" \
5+
-H "Authorization: Bearer $AUTH" \
6+
-H "Content-Type: application/json")
7+
8+
SIGNED_URL=$(echo "$RESPONSE" | jq -r '.url')
9+
10+
if [[ "$SIGNED_URL" == "null" ]]; then
11+
echo -e "\033[31mFailed to get signed URL.\033[0m"
12+
exit 1
13+
fi
14+
15+
UPLOAD_RESPONSE=$(tar -cz . | curl -v -X PUT \
16+
-H "Content-Type: application/gzip" \
17+
--data-binary @- "$SIGNED_URL" 2>&1)
18+
19+
if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then
20+
echo -e "\033[32mUploaded build to Stainless storage.\033[0m"
21+
echo -e "\033[32mInstallation: npm install 'https://pkg.stainless.com/s/codex-python/$SHA'\033[0m"
22+
else
23+
echo -e "\033[31mFailed to upload artifact.\033[0m"
24+
exit 1
25+
fi

src/codex/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3+
import typing as _t
4+
35
from . import types
46
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
57
from ._utils import file_from_path
@@ -80,6 +82,9 @@
8082
"DefaultAsyncHttpxClient",
8183
]
8284

85+
if not _t.TYPE_CHECKING:
86+
from ._utils._resources_proxy import resources as resources
87+
8388
_setup_logging()
8489

8590
# Update the __module__ attribute for exported symbols so that

src/codex/_utils/_proxy.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,10 @@ def __dir__(self) -> Iterable[str]:
4646
@property # type: ignore
4747
@override
4848
def __class__(self) -> type: # pyright: ignore
49-
proxied = self.__get_proxied__()
49+
try:
50+
proxied = self.__get_proxied__()
51+
except Exception:
52+
return type(self)
5053
if issubclass(type(proxied), LazyProxy):
5154
return type(proxied)
5255
return proxied.__class__

src/codex/_utils/_resources_proxy.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
from __future__ import annotations
2+
3+
from typing import Any
4+
from typing_extensions import override
5+
6+
from ._proxy import LazyProxy
7+
8+
9+
class ResourcesProxy(LazyProxy[Any]):
10+
"""A proxy for the `codex.resources` module.
11+
12+
This is used so that we can lazily import `codex.resources` only when
13+
needed *and* so that users can just import `codex` and reference `codex.resources`
14+
"""
15+
16+
@override
17+
def __load__(self) -> Any:
18+
import importlib
19+
20+
mod = importlib.import_module("codex.resources")
21+
return mod
22+
23+
24+
resources = ResourcesProxy().__as_proxied__()

src/codex/_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__ = "codex"
4-
__version__ = "0.1.0-alpha.19" # x-release-please-version
4+
__version__ = "0.1.0-alpha.20" # x-release-please-version

0 commit comments

Comments
 (0)