Skip to content
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

chore: move to using Ruff #691

Merged
merged 5 commits into from
Feb 22, 2023
Merged

Conversation

henryiii
Copy link
Collaborator

@henryiii henryiii commented Feb 8, 2023

Ruff can take the place of a lot of other tools, and is 10-100x faster (written in Rust), plugins can't get out of sync, zero dependencies, can auto-fix in some cases, pyproject.toml configuration, and poetry-core updates can't break it (like isort). :)

cibuildwheel, build, scipy, and others have already moved to it.

There are some other nice codes we could enable, but stuck with either what was there before or easy-to-enable (minimal changes) ones.

@henryiii
Copy link
Collaborator Author

henryiii commented Feb 9, 2023

I can remove some of the pygrep hooks too, I missed that.

@FollowTheProcess
Copy link
Collaborator

Big thumbs up from me, love ruff. I've switched to it on a lot of personal projects.

The one thing I'd say though is it does get released a lot (not a bad thing at all) so I think if we're going to adopt it I'd like to see us also adopt pre-commit CI to always keep these things up to date for us 👍🏻

@theacodes Is this something you'd be on board with? Would need some
setup/permissions on the repo to go in this direction 🙂

Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
Signed-off-by: Henry Schreiner <[email protected]>
@henryiii
Copy link
Collaborator Author

While Ruff updates frequently, it's actually more stable than flake8, since it has zero dependencies and is just a binary. So the only forced reason to update would be for new platforms (like a new version of Python), but other than that, it should work indefinitely. Something like a dependency updating can't break it.

- id: python-check-blanket-noqa
- id: python-check-blanket-type-ignore
- id: python-no-log-warn
exclude: ^tests/test_sessions.py$
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ruff's implementation is smarter than a simple grep, so it can tell session.warn isn't logging's warn! :)

Signed-off-by: Henry Schreiner <[email protected]>
@henryiii
Copy link
Collaborator Author

henryiii commented Feb 21, 2023

Looks like pyproject-fmt is broken, it just keeps adding an extra line of space between tool.ruff and previous entries. It's also removing space between project headings, which I don't like - I personally like one line between related sections, and two lines between unrelated sections (like tool.stuff sections). Looks like it's tox-dev/pyproject-fmt#69 and will be fixed in tox-dev/pyproject-fmt#70. I'll revert that bump.

Signed-off-by: Henry Schreiner <[email protected]>
@cjolowicz cjolowicz self-requested a review February 22, 2023 07:43
@FollowTheProcess
Copy link
Collaborator

The pre commit CI thing was never a blocker for this, just something to consider adopting going forward. Happy to see this come in 👍🏻

Copy link
Collaborator

@DiddiLeija DiddiLeija left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pre commit CI thing was never a blocker for this, just something to consider adopting going forward. Happy to see this come in 👍🏻

In that case LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants