-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
switch to ruff #5218
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
base: main
Are you sure you want to change the base?
switch to ruff #5218
Conversation
@gvwilson big picture comments --
|
af41d30
to
9c60129
Compare
What would you think of adding an item to the pull request template documentations section that recommends: [ ] start Python code blocks with ```python? It's something that is not obvious in the checklist and that I've forgotten to do a couple times. Forgetting to do so can prevent the example from displaying. |
@gvwilson Are we switching to use the |
4eaa080
to
3beb48c
Compare
- Remove `requires-optional.txt` and `test_requirements/*` (no longer used). - Convert `commands.py` to use `argparse` instead of hand-rolled. - Rationalize imports in `codegen/__init__.py` (all at top level). - Divide dependencies in `pyproject.toml` into core and optional. - Update `pyproject.toml` to install `inflect` and `requests`. - Modify `uv.lock` file. - Modify code reformatting in `codegen/__init__.py` to use `ruff` instead of `black`. - Add new function to use `ruff` to reformat existing code (run `python commands.py format`). - Add new function to use `ruff` to check code (run `python commands.py lint`). - Regenerate code and reformat using `ruff` - Replace uses of `uv pip` with `uv sync` in `.circleci/config.yml`. - Clean up several hundred complaints from `ruff` about unused variables and imports. - Clean up cases in `tests/**/*.py` where the same function name was used for several tests (which meant that only the last one defined was actually run). Note: `uv.lock` reflects `dev_optional`, i.e., pins *all* dependencies.
@emilykl clean build - I've put |
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.
Delete this file I guess. LOL
- Run `ruff format --check .` instead of `ruff format .` in Circle CI. - Use `base_type is list` instead of `base_type == list`. - Remove commented-out lines of code. - Remove unnecessary parentheses around some strings. - Be more consistent about (re-)naming test functions that had duplicated names. - Use `noqa: F401` to suppress `ruff check` complaint about unused import.
.circleci/config.yml
Outdated
@@ -125,8 +122,7 @@ commands: | |||
curl -LsSf https://astral.sh/uv/install.sh | sh | |||
uv venv | |||
source .venv/bin/activate | |||
uv pip install . | |||
uv pip install -r ./test_requirements/requirements_optional.txt | |||
uv pip install .[dev_optional] |
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.
For consistency, this should use uv sync
, right?
uv pip install .[dev_optional] | |
uv sync --extra dev_optional |
requires-optional.txt
andtest_requirements/*
(no longer used).commands.py
to useargparse
instead of hand-rolled.codegen/__init__.py
(all at top level)."dev"
section ofpyproject.toml
to useruff
instead ofblack
.pyproject.toml
to installinflect
andrequests
.uv.lock
file.codegen/__init__.py
to useruff
instead ofblack
.ruff
to reformat existing code (runpython commands.py format
).ruff
to check code (runpython commands.py lint
).This PR has been rebuilt on top of #5214 to include recent changes to validator generation.
This PR currently fails the build because Circle CI is expecting
requires-optional.txt
, which this PR removes.We need to decide if we're leaving build on Circle CI or moving it to GitHub.