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

Use ruff instead of black+isort #644

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

AdrienVannson
Copy link
Contributor

@AdrienVannson AdrienVannson commented Nov 13, 2024

Summary

Use Ruff instead of black+isort. This has the following avantages:

  • Ruff is much faster than black+isort. In my project, it reduced the compilation time of the proto files by half. It will also make the use in the project more convenient.
  • It will allow to greatly simplify how import are added to the output file. Instead of having a lot of code to check which imports need to be added to the generated file, it is possible to add all of them and tell Ruff to remove the useless ones. It will make everything easier and less subject to bugs
  • In some cases, the formatting may be better

This was requested in #488 , and I agree it is a good choice.

For now, Ruff is only used as a formatter and not as a linter

Checklist

  • If code changes were made then they have been tested.
  • This PR fixes an issue.

@AdrienVannson AdrienVannson marked this pull request as draft November 13, 2024 14:41
@AdrienVannson AdrienVannson marked this pull request as ready for review November 13, 2024 15:28
cetanu
cetanu previously approved these changes Nov 15, 2024
@AdrienVannson
Copy link
Contributor Author

Actually, I need to check one last thing before merging

@AdrienVannson
Copy link
Contributor Author

I pinned the Ruff version in pyproject.toml to avoid having a problem that occurred previously with black+isort: the version of black was updated in the environment, but the old version was still used in the pre-commit... Which used to cause the pre-commit to fail even after running poe format

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

Successfully merging this pull request may close these issues.

2 participants