Replace Black with Ruff #923
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
Which issue is resolved by this Pull Request:
See: #739
Description of your changes:
Ruff is an extremely fast Python linter and code formatter, written in Rust. It is a fantastic tool that combines the features of flake8 linter, isort, Black code formatter, and (to some degree) pylint in one tool. It comes with over 800 linting rules. Ruff is not only blazing fast, it can also fix most code violation. The code fixer is a fantastic quality of life feature for developers.
Gradually introduce Ruff for linting and code formatting. Replaces Black as code formatting tool. Ruff is configured to create the same results as Black's default configuration.
More Ruff linters will be enabled in future commits.
make verify
now performs a fast and lean check, which detects most problems except for some import errors.$ rm -rf .tox $ make verify tox p -e fastlint,ruff ruff: OK ✔ in 4.09 seconds fastlint: OK (13.21=setup[7.08]+cmd[6.13] seconds) ruff: OK (4.09=setup[3.85]+cmd[0.25] seconds) congratulations :) (13.49 seconds) $ du --si -s .tox/ 65M .tox/
Normal
lint
downloads and creates a large virtual env, which takes several minutes: