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

Switch to ruff for formatting #3817

Closed
DeD1rk opened this issue Oct 21, 2024 · 3 comments · Fixed by #3823
Closed

Switch to ruff for formatting #3817

DeD1rk opened this issue Oct 21, 2024 · 3 comments · Fixed by #3823
Assignees
Labels
chore Something that is not a bug or a feature, does not change production behaviour easy and fun Easy to solve priority: low Should be dealt with when nothing else remains. request-for-comments Author wants to have other people respond for their opinion skip-changelog Mark Pull Requests so that they do not appear in the changelog
Milestone

Comments

@DeD1rk
Copy link
Member

DeD1rk commented Oct 21, 2024

What?

ruff has a formatter and import sorter that is much faster than black and isort. I think it would be nice to switch to that.

Why?

Nicer dev experience.

How?

  • Change the depenencies.
  • Update configurations in pyproject.toml and .pre-commit-config.yaml.
  • Update the Makefile
  • Update the README
  • Update vscode settings to enable formatting with ruff onsave, and disable isort and black.
@DeD1rk DeD1rk added priority: low Should be dealt with when nothing else remains. easy and fun Easy to solve request-for-comments Author wants to have other people respond for their opinion chore Something that is not a bug or a feature, does not change production behaviour skip-changelog Mark Pull Requests so that they do not appear in the changelog labels Oct 21, 2024
@ColonelPhantom
Copy link
Contributor

Sounds good, will there be any differences between the style black uses and what ruff will do?

@DeD1rk
Copy link
Member Author

DeD1rk commented Oct 23, 2024

Here's an overview of the differences from black: https://docs.astral.sh/ruff/formatter/black/.
I get 7-9 lines in total.

@ColonelPhantom
Copy link
Contributor

Differences seem pretty small, nice! That said I do get 142 files changed (+200, -68) when I run ruff format, mostly because of an extra newline before imports. When I ignore the files with only 1 line changed I get 12 files.

@T8902 T8902 modified the milestones: Release 56, Release 57 Nov 4, 2024
@DeD1rk DeD1rk self-assigned this Nov 7, 2024
@T8902 T8902 modified the milestones: Release 57, Release 56 Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Something that is not a bug or a feature, does not change production behaviour easy and fun Easy to solve priority: low Should be dealt with when nothing else remains. request-for-comments Author wants to have other people respond for their opinion skip-changelog Mark Pull Requests so that they do not appear in the changelog
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants