Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request replaces Black and Isort with Ruff for code formatting and import sorting across multiple packages, deprecating the legacy blacken Nox sessions in favor of Ruff-based formatting. It also introduces or updates pyproject.toml configurations for Ruff. The review feedback recommends defining the target-version directly within each pyproject.toml file to ensure consistency across environments and to simplify the noxfile.py configurations by removing redundant command-line arguments.
| [tool.ruff] | ||
| line-length = 88 |
There was a problem hiding this comment.
Configuring target-version directly in pyproject.toml is a best practice for Ruff. It ensures that IDEs, pre-commit hooks, and manual CLI runs all use the correct target Python version consistently without needing to pass it as a command-line argument. This also allows simplifying the noxfile.py configurations across all packages.
| [tool.ruff] | |
| line-length = 88 | |
| [tool.ruff] | |
| line-length = 88 | |
| target-version = "py38" |
| session.run( | ||
| "black", | ||
| "ruff", | ||
| "format", | ||
| f"--target-version=py{UNIT_TEST_PYTHON_VERSIONS[0].replace('.', '')}", | ||
| "--line-length=88", | ||
| *LINT_PATHS, | ||
| ) |
There was a problem hiding this comment.
Since line-length = 88 is already configured in pyproject.toml, and target-version can also be configured there (e.g., target-version = "py38"), passing these options as command-line arguments in noxfile.py is redundant. Relying on pyproject.toml simplifies the noxfile.py configuration and avoids package-specific variable name discrepancies (such as UNIT_TEST_PYTHON_VERSIONS vs ALL_PYTHON).
session.run(
"ruff",
"format",
*LINT_PATHS,
)| session.run( | ||
| "black", | ||
| "ruff", | ||
| "format", | ||
| f"--target-version=py{ALL_PYTHON[0].replace('.', '')}", | ||
| "--line-length=88", | ||
| *LINT_PATHS, | ||
| ) |
There was a problem hiding this comment.
Since line-length = 88 is already configured in pyproject.toml, and target-version can also be configured there (e.g., target-version = "py38"), passing these options as command-line arguments in noxfile.py is redundant. Relying on pyproject.toml simplifies the noxfile.py configuration and avoids package-specific variable name discrepancies (such as UNIT_TEST_PYTHON_VERSIONS vs ALL_PYTHON).
session.run(
"ruff",
"format",
*LINT_PATHS,
)
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
Fixes #<issue_number_goes_here> 🦕