Use dependency groups for Python SDK tooling#27538
Conversation
| /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 . |
There was a problem hiding this comment.
I added --frozen --no-sync here since the intent seems to be to sync once upfront, then run in that environment.
There was a problem hiding this comment.
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.
| @@ -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] | |||
There was a problem hiding this comment.
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).
| "--frozen", | ||
| "--project", | ||
| "scripts", | ||
| "--no-sync", |
There was a problem hiding this comment.
scripts only defines this one dependency; we could move it to a group but I guess the project itself is dev-only.
| "--frozen", | ||
| "--project", | ||
| "scripts", | ||
| "--no-sync", |
There was a problem hiding this comment.
same question as https://github.com/openai/codex/pull/27538/changes#r3393355328
| sdk_format_args = [ | ||
| *sdk_uv_run_args, | ||
| "ruff", | ||
| "format", | ||
| ] | ||
| scripts_format_args = [ | ||
| *scripts_uv_run_args, | ||
| "ruff", | ||
| "format", | ||
| ] |
There was a problem hiding this comment.
should these use uv format instead of the complex uv run thing?
Summary
just fmtpreviously useduv run --with ruffto make Ruff available. Because--withcreates an ephemeral overlay outside the project lockfile, uv periodically re-resolved Ruff (by default every 10 minutes) instead of using the version recorded inuv.lock.Move the Python SDK tooling dependencies from the published
devextra intoformat,test, and composeddevdependency groups. The formatter now selects only the lockedformatgroup, contributor and CI setup explicitly sync thedevgroup, and CI and release commands reuse that environment with--frozen --no-sync. The scripts formatter also uses its project's locked Ruff dependency instead of an ephemeral overlay.Validated the Python 3.12 SDK suite (119 passed, 38 skipped) and the repository formatter.