-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Use dependency groups for Python SDK tooling #27538
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this also use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| "--with", | ||
| "ruff", | ||
| ] | ||
| sdk_format_args = [ | ||
| *sdk_uv_run_args, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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] | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| 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 = [ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same question as https://github.com/openai/codex/pull/27538/changes#r3393355328 |
||
| "--with", | ||
| "ruff", | ||
| ) | ||
| assert all( | ||
| command.args[: len(sdk_uv_run_args)] == sdk_uv_run_args | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added
--frozen --no-synchere since the intent seems to be to sync once upfront, then run in that environment.There was a problem hiding this comment.
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-syncfor performance here? It seems like we should just be usinguv run --frozenwithout an initial sync. I think that's separate in intent from this change though.