Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/python-sdk-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ jobs:
sh -euxc '
python -m venv /tmp/release-tools
/tmp/release-tools/bin/python -m pip install build twine uv==0.11.3
/tmp/release-tools/bin/uv sync --extra dev --frozen
/tmp/release-tools/bin/uv run --extra dev --frozen python scripts/update_sdk_artifacts.py \
/tmp/release-tools/bin/uv sync --group dev --frozen
/tmp/release-tools/bin/uv run --frozen --no-sync python scripts/update_sdk_artifacts.py \
stage-sdk "${SDK_STAGE_DIR}" \
--sdk-version "${SDK_VERSION}"
/tmp/release-tools/bin/python -m build \
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ jobs:
sh -euxc '
python -m venv /tmp/uv
/tmp/uv/bin/python -m pip install uv==0.11.3
/tmp/uv/bin/uv sync --extra dev --frozen
/tmp/uv/bin/uv run --extra dev ruff check --output-format=github .
/tmp/uv/bin/uv run --extra dev ruff format --check .
/tmp/uv/bin/uv run --extra dev pytest
/tmp/uv/bin/uv sync --group dev --frozen
/tmp/uv/bin/uv run --frozen --no-sync ruff check --output-format=github .

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added --frozen --no-sync here since the intent seems to be to sync once upfront, then run in that environment.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we using an initial sync with subsequent --no-sync for performance here? It seems like we should just be using uv run --frozen without an initial sync. I think that's separate in intent from this change though.

/tmp/uv/bin/uv run --frozen --no-sync ruff format --check .
/tmp/uv/bin/uv run --frozen --no-sync pytest
'
sdks:
Expand Down
11 changes: 3 additions & 8 deletions scripts/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,22 @@ class FormatterResult:
def formatter_groups(*, check: bool) -> tuple[FormatterGroup, ...]:
just_args = ["just", "--unstable", "--fmt"]
cargo_args = ["cargo", "fmt", "--", "--config", "imports_granularity=Item"]
# Use an unpinned overlay so Ruff is available without syncing project
# dependencies. Each `--project` still retains its local configuration context.
# Each `--project` retains its local dependency and Ruff configuration context.
sdk_uv_run_args = [
"uv",
"run",
"--frozen",
"--project",
"sdk/python",
"--no-sync",
"--with",
"ruff",
"--only-group",
"format",
]
scripts_uv_run_args = [
"uv",
"run",
"--frozen",
"--project",
"scripts",
"--no-sync",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also use --only-group?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scripts only defines this one dependency; we could move it to a group but I guess the project itself is dev-only.

"--with",
"ruff",
]
sdk_format_args = [
*sdk_uv_run_args,
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ the repository:

```bash
cd sdk/python
uv sync --extra dev
uv sync --group dev
source .venv/bin/activate
```

Expand Down
2 changes: 1 addition & 1 deletion sdk/python/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Contributors using these checked-in scripts should install development
dependencies from `sdk/python`:

```bash
uv sync --extra dev
uv sync --group dev
source .venv/bin/activate
```

Expand Down
13 changes: 11 additions & 2 deletions sdk/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,17 @@ Repository = "https://github.com/openai/codex"
Issues = "https://github.com/openai/codex/issues"
Documentation = "https://github.com/openai/codex/tree/main/sdk/python/docs"

[project.optional-dependencies]
dev = ["pytest>=8.0", "datamodel-code-generator==0.31.2", "ruff>=0.15.8"]
[dependency-groups]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dependency-groups have the crucial property that they can be installed without installing the project itself (which is, I think, the intent of the flow in the justfile: install Ruff, but not the project).

format = ["ruff>=0.15.8"]
test = [
"pytest>=8.0",
"datamodel-code-generator==0.31.2",
{ include-group = "format" },
]
dev = [
{ include-group = "test" },
{ include-group = "format" },
]

[tool.hatch.build]
exclude = [
Expand Down
8 changes: 2 additions & 6 deletions sdk/python/tests/test_artifact_workflow_and_binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,15 @@ def test_root_format_driver_covers_all_formatter_groups() -> None:
"--frozen",
"--project",
"sdk/python",
"--no-sync",
"--with",
"ruff",
"--only-group",
"format",
)
scripts_uv_run_args = (
"uv",
"run",
"--frozen",
"--project",
"scripts",
"--no-sync",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"--with",
"ruff",
)
assert all(
command.args[: len(sdk_uv_run_args)] == sdk_uv_run_args
Expand Down
27 changes: 22 additions & 5 deletions sdk/python/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading