Skip to content

release: 0.1.0-alpha.13 #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Apr 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}

USER vscode

RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.35.0" RYE_INSTALL_OPTION="--yes" bash
RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.44.0" RYE_INSTALL_OPTION="--yes" bash
ENV PATH=/home/vscode/.rye/shims:$PATH

RUN echo "[[ -d .venv ]] && source .venv/bin/activate || export PATH=\$PATH" >> /home/vscode/.bashrc
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: '0.35.0'
RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'

- name: Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
curl -sSf https://rye.astral.sh/get | bash
echo "$HOME/.rye/shims" >> $GITHUB_PATH
env:
RYE_VERSION: '0.35.0'
RYE_VERSION: '0.44.0'
RYE_INSTALL_OPTION: '--yes'

- name: Publish to PyPI
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.0-alpha.12"
".": "0.1.0-alpha.13"
}
4 changes: 3 additions & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
configured_endpoints: 37
configured_endpoints: 36
openapi_spec_hash: 4e7cb2cd6132c29f60a87a958f617a41
config_hash: adbedb6317fca6f566f54564cc341846
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Changelog

## 0.1.0-alpha.13 (2025-04-02)

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

### Features

* **api:** api update ([#83](https://github.com/cleanlab/codex-python/issues/83)) ([b41e3bf](https://github.com/cleanlab/codex-python/commit/b41e3bf21e10b11b6d64e15f320cf3d8aa66bfb8))
* **api:** api update ([#90](https://github.com/cleanlab/codex-python/issues/90)) ([52933f2](https://github.com/cleanlab/codex-python/commit/52933f2bc708e1f2b5f2e144071a9ee41b27251c))
* **api:** updates from question grouping ([#93](https://github.com/cleanlab/codex-python/issues/93)) ([14da023](https://github.com/cleanlab/codex-python/commit/14da02311e598a1d5f4e41a100160b81befd4f61))


### Bug Fixes

* **ci:** ensure pip is always available ([#88](https://github.com/cleanlab/codex-python/issues/88)) ([86a40cc](https://github.com/cleanlab/codex-python/commit/86a40ccd3892d23bb12f78bf5ff13eaa23d8eb2d))
* **ci:** remove publishing patch ([#89](https://github.com/cleanlab/codex-python/issues/89)) ([674c661](https://github.com/cleanlab/codex-python/commit/674c6613c7709c93cca936f086d5348041252972))
* **types:** handle more discriminated union shapes ([#87](https://github.com/cleanlab/codex-python/issues/87)) ([ea6a942](https://github.com/cleanlab/codex-python/commit/ea6a9422c2a1ff25f14ade1a790ffd943dadbd81))


### Chores

* fix typos ([#91](https://github.com/cleanlab/codex-python/issues/91)) ([6b97689](https://github.com/cleanlab/codex-python/commit/6b97689646d7b3611ace81c630fafa1962b5c94d))
* **internal:** bump rye to 0.44.0 ([#86](https://github.com/cleanlab/codex-python/issues/86)) ([e026b73](https://github.com/cleanlab/codex-python/commit/e026b73fb62aa19689890f14b7dcf355910029a8))
* **internal:** codegen related update ([#85](https://github.com/cleanlab/codex-python/issues/85)) ([7e1eaca](https://github.com/cleanlab/codex-python/commit/7e1eaca4c5f2c779b264c34883688b52e1a8602e))
* **internal:** remove extra empty newlines ([#84](https://github.com/cleanlab/codex-python/issues/84)) ([e4b2929](https://github.com/cleanlab/codex-python/commit/e4b2929d58b466199bb02e24b8e0a7c9c63f1b3a))
* **internal:** version bump ([#81](https://github.com/cleanlab/codex-python/issues/81)) ([7ee4e09](https://github.com/cleanlab/codex-python/commit/7ee4e09545e52eaa3d10522709e833b38221ecad))

## 0.1.0-alpha.12 (2025-03-11)

Full Changelog: [v0.1.0-alpha.11...v0.1.0-alpha.12](https://github.com/cleanlab/codex-python/compare/v0.1.0-alpha.11...v0.1.0-alpha.12)
Expand Down
20 changes: 15 additions & 5 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Methods:

- <code title="get /api/health/">client.health.<a href="./src/codex/resources/health.py">check</a>() -> <a href="./src/codex/types/health_check_response.py">HealthCheckResponse</a></code>
- <code title="get /api/health/db">client.health.<a href="./src/codex/resources/health.py">db</a>() -> <a href="./src/codex/types/health_check_response.py">HealthCheckResponse</a></code>
- <code title="get /api/health/weaviate">client.health.<a href="./src/codex/resources/health.py">weaviate</a>() -> <a href="./src/codex/types/health_check_response.py">HealthCheckResponse</a></code>

# Organizations

Expand Down Expand Up @@ -175,18 +174,29 @@ Methods:
Types:

```python
from codex.types.projects import Entry
from codex.types.projects import Entry, EntryQueryResponse
```

Methods:

- <code title="post /api/projects/{project_id}/entries/">client.projects.entries.<a href="./src/codex/resources/projects/entries.py">create</a>(project_id, \*\*<a href="src/codex/types/projects/entry_create_params.py">params</a>) -> <a href="./src/codex/types/projects/entry.py">Entry</a></code>
- <code title="get /api/projects/{project_id}/entries/{entry_id}">client.projects.entries.<a href="./src/codex/resources/projects/entries.py">retrieve</a>(entry_id, \*, project_id) -> <a href="./src/codex/types/projects/entry.py">Entry</a></code>
- <code title="put /api/projects/{project_id}/entries/{entry_id}">client.projects.entries.<a href="./src/codex/resources/projects/entries.py">update</a>(entry_id, \*, project_id, \*\*<a href="src/codex/types/projects/entry_update_params.py">params</a>) -> <a href="./src/codex/types/projects/entry.py">Entry</a></code>
- <code title="get /api/projects/{project_id}/entries/">client.projects.entries.<a href="./src/codex/resources/projects/entries.py">list</a>(project_id, \*\*<a href="src/codex/types/projects/entry_list_params.py">params</a>) -> <a href="./src/codex/types/projects/entry.py">SyncOffsetPageEntries[Entry]</a></code>
- <code title="delete /api/projects/{project_id}/entries/{entry_id}">client.projects.entries.<a href="./src/codex/resources/projects/entries.py">delete</a>(entry_id, \*, project_id) -> None</code>
- <code title="post /api/projects/{project_id}/entries/add_question">client.projects.entries.<a href="./src/codex/resources/projects/entries.py">add_question</a>(project_id, \*\*<a href="src/codex/types/projects/entry_add_question_params.py">params</a>) -> <a href="./src/codex/types/projects/entry.py">Entry</a></code>
- <code title="post /api/projects/{project_id}/entries/query">client.projects.entries.<a href="./src/codex/resources/projects/entries.py">query</a>(project_id, \*\*<a href="src/codex/types/projects/entry_query_params.py">params</a>) -> <a href="./src/codex/types/projects/entry.py">Optional[Entry]</a></code>
- <code title="post /api/projects/{project_id}/entries/query">client.projects.entries.<a href="./src/codex/resources/projects/entries.py">query</a>(project_id, \*\*<a href="src/codex/types/projects/entry_query_params.py">params</a>) -> <a href="./src/codex/types/projects/entry_query_response.py">EntryQueryResponse</a></code>

## Clusters

Types:

```python
from codex.types.projects import ClusterListResponse, ClusterListVariantsResponse
```

Methods:

- <code title="get /api/projects/{project_id}/entries/clusters">client.projects.clusters.<a href="./src/codex/resources/projects/clusters.py">list</a>(project_id, \*\*<a href="src/codex/types/projects/cluster_list_params.py">params</a>) -> <a href="./src/codex/types/projects/cluster_list_response.py">SyncOffsetPageClusters[ClusterListResponse]</a></code>
- <code title="get /api/projects/{project_id}/entries/clusters/{representative_entry_id}">client.projects.clusters.<a href="./src/codex/resources/projects/clusters.py">list_variants</a>(representative_entry_id, \*, project_id) -> <a href="./src/codex/types/projects/cluster_list_variants_response.py">ClusterListVariantsResponse</a></code>

# Tlm

Expand Down
3 changes: 0 additions & 3 deletions bin/publish-pypi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@
set -eux
mkdir -p dist
rye build --clean
# Patching importlib-metadata version until upstream library version is updated
# https://github.com/pypa/twine/issues/977#issuecomment-2189800841
"$HOME/.rye/self/bin/python3" -m pip install 'importlib-metadata==7.2.1'
rye publish --yes --token=$PYPI_TOKEN
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "codex-sdk"
version = "0.1.0-alpha.12"
version = "0.1.0-alpha.13"
description = "Internal SDK used within cleanlab-codex package. Refer to https://pypi.org/project/cleanlab-codex/ instead."
dynamic = ["readme"]
license = "MIT"
Expand Down Expand Up @@ -38,7 +38,6 @@ Homepage = "https://github.com/cleanlab/codex-python"
Repository = "https://github.com/cleanlab/codex-python"



[tool.rye]
managed = true
# version pins are in requirements-dev.lock
Expand Down Expand Up @@ -87,7 +86,7 @@ typecheck = { chain = [
"typecheck:mypy" = "mypy ."

[build-system]
requires = ["hatchling", "hatch-fancy-pypi-readme"]
requires = ["hatchling==1.26.3", "hatch-fancy-pypi-readme"]
build-backend = "hatchling.build"

[tool.hatch.build]
Expand Down Expand Up @@ -152,7 +151,6 @@ reportImplicitOverride = true
reportImportCycles = false
reportPrivateUsage = false


[tool.ruff]
line-length = 120
output-format = "grouped"
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# all-features: true
# with-sources: false
# generate-hashes: false
# universal: false

-e file:.
annotated-types==0.6.0
Expand Down
1 change: 1 addition & 0 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# all-features: true
# with-sources: false
# generate-hashes: false
# universal: false

-e file:.
annotated-types==0.6.0
Expand Down
9 changes: 6 additions & 3 deletions src/codex/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
from ._constants import RAW_RESPONSE_HEADER

if TYPE_CHECKING:
from pydantic_core.core_schema import ModelField, LiteralSchema, ModelFieldsSchema
from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema

__all__ = ["BaseModel", "GenericModel"]

Expand Down Expand Up @@ -646,15 +646,18 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,

def _extract_field_schema_pv2(model: type[BaseModel], field_name: str) -> ModelField | None:
schema = model.__pydantic_core_schema__
if schema["type"] == "definitions":
schema = schema["schema"]

if schema["type"] != "model":
return None

schema = cast("ModelSchema", schema)
fields_schema = schema["schema"]
if fields_schema["type"] != "model-fields":
return None

fields_schema = cast("ModelFieldsSchema", fields_schema)

field = fields_schema["fields"].get(field_name)
if not field:
return None
Expand All @@ -678,7 +681,7 @@ def set_pydantic_config(typ: Any, config: pydantic.ConfigDict) -> None:
setattr(typ, "__pydantic_config__", config) # noqa: B010


# our use of subclasssing here causes weirdness for type checkers,
# our use of subclassing here causes weirdness for type checkers,
# so we just pretend that we don't subclass
if TYPE_CHECKING:
GenericModel = BaseModel
Expand Down
2 changes: 1 addition & 1 deletion src/codex/_utils/_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def _get_annotated_type(type_: type) -> type | None:
def _maybe_transform_key(key: str, type_: type) -> str:
"""Transform the given `data` based on the annotations provided in `type_`.

Note: this function only looks at `Annotated` types that contain `PropertInfo` metadata.
Note: this function only looks at `Annotated` types that contain `PropertyInfo` metadata.
"""
annotated_type = _get_annotated_type(type_)
if annotated_type is None:
Expand Down
2 changes: 1 addition & 1 deletion src/codex/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "codex"
__version__ = "0.1.0-alpha.12" # x-release-please-version
__version__ = "0.1.0-alpha.13" # x-release-please-version
62 changes: 62 additions & 0 deletions src/codex/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
__all__ = [
"SyncMyOffsetPageTopLevelArray",
"AsyncMyOffsetPageTopLevelArray",
"SyncOffsetPageClusters",
"AsyncOffsetPageClusters",
"SyncOffsetPageEntries",
"AsyncOffsetPageEntries",
]
Expand Down Expand Up @@ -83,6 +85,66 @@ def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseM
)


class SyncOffsetPageClusters(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
clusters: List[_T]
total_count: Optional[int] = None

@override
def _get_page_items(self) -> List[_T]:
clusters = self.clusters
if not clusters:
return []
return clusters

@override
def next_page_info(self) -> Optional[PageInfo]:
offset = self._options.params.get("offset") or 0
if not isinstance(offset, int):
raise ValueError(f'Expected "offset" param to be an integer but got {offset}')

length = len(self._get_page_items())
current_count = offset + length

total_count = self.total_count
if total_count is None:
return None

if current_count < total_count:
return PageInfo(params={"offset": current_count})

return None


class AsyncOffsetPageClusters(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
clusters: List[_T]
total_count: Optional[int] = None

@override
def _get_page_items(self) -> List[_T]:
clusters = self.clusters
if not clusters:
return []
return clusters

@override
def next_page_info(self) -> Optional[PageInfo]:
offset = self._options.params.get("offset") or 0
if not isinstance(offset, int):
raise ValueError(f'Expected "offset" param to be an integer but got {offset}')

length = len(self._get_page_items())
current_count = offset + length

total_count = self.total_count
if total_count is None:
return None

if current_count < total_count:
return PageInfo(params={"offset": current_count})

return None


class SyncOffsetPageEntries(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
entries: List[_T]
total_count: Optional[int] = None
Expand Down
50 changes: 0 additions & 50 deletions src/codex/resources/health.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,25 +77,6 @@ def db(
cast_to=HealthCheckResponse,
)

def weaviate(
self,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> HealthCheckResponse:
"""Check the weaviate connection."""
return self._get(
"/api/health/weaviate",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=HealthCheckResponse,
)


class AsyncHealthResource(AsyncAPIResource):
@cached_property
Expand Down Expand Up @@ -155,25 +136,6 @@ async def db(
cast_to=HealthCheckResponse,
)

async def weaviate(
self,
*,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
) -> HealthCheckResponse:
"""Check the weaviate connection."""
return await self._get(
"/api/health/weaviate",
options=make_request_options(
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
),
cast_to=HealthCheckResponse,
)


class HealthResourceWithRawResponse:
def __init__(self, health: HealthResource) -> None:
Expand All @@ -185,9 +147,6 @@ def __init__(self, health: HealthResource) -> None:
self.db = to_raw_response_wrapper(
health.db,
)
self.weaviate = to_raw_response_wrapper(
health.weaviate,
)


class AsyncHealthResourceWithRawResponse:
Expand All @@ -200,9 +159,6 @@ def __init__(self, health: AsyncHealthResource) -> None:
self.db = async_to_raw_response_wrapper(
health.db,
)
self.weaviate = async_to_raw_response_wrapper(
health.weaviate,
)


class HealthResourceWithStreamingResponse:
Expand All @@ -215,9 +171,6 @@ def __init__(self, health: HealthResource) -> None:
self.db = to_streamed_response_wrapper(
health.db,
)
self.weaviate = to_streamed_response_wrapper(
health.weaviate,
)


class AsyncHealthResourceWithStreamingResponse:
Expand All @@ -230,6 +183,3 @@ def __init__(self, health: AsyncHealthResource) -> None:
self.db = async_to_streamed_response_wrapper(
health.db,
)
self.weaviate = async_to_streamed_response_wrapper(
health.weaviate,
)
Loading