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

Update pre-commit configuration to use Ruff for linting and formatting #4015

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

Conversation

cuza
Copy link
Member

@cuza cuza commented Mar 3, 2025

  • Replaced pre-commit hooks flake8, black, pyupgrade, etc. with ruff for linting and formatting.
  • Updated to use ubuntu-22.04 and Python 3.8 instead of ubuntu-20.04 and Python 3.7 for the tox, k8s_itests, and build_debs jobs.

@cuza cuza requested a review from a team as a code owner March 3, 2025 23:05
@Rob-Johnson
Copy link
Contributor

@cuza can I ask why? we use black for everything else at Yelp

@cuza
Copy link
Member Author

cuza commented Mar 4, 2025

@cuza can I ask why? we use black for everything else at Yelp.

@Rob-Johnson Great question, ruff is black/flake8 compatible, it's a lot faster than black/flake8, like more than 10 times faster, is becoming the industry std linter and formatter and consolidate every other python linter/formatter that we use for pre-commits hooks into one single tool.

For context here's a comparison of some python tools linting the entire CPython codebase from scratch.
image

@cuza cuza force-pushed the cuza/replacing-flake8,-black,-pyupgrade,etc-with-ruff branch from 7c64460 to 815ba44 Compare March 4, 2025 20:30
@cuza cuza force-pushed the cuza/replacing-flake8,-black,-pyupgrade,etc-with-ruff branch from a2b1522 to 99cd291 Compare March 4, 2025 20:45
@cuza cuza force-pushed the cuza/replacing-flake8,-black,-pyupgrade,etc-with-ruff branch from d3caaa0 to a3c2ce5 Compare March 4, 2025 21:03
@lfdominguez
Copy link

@cuza can I ask why? we use black for everything else at Yelp

ruff is converting into the new "standard" because include flake and black and additional rules. Far outperforms other linters, this give to you minor deploy time, so your DORA metrics because reduce the wait for linter step. Can check the format of the code too to maintain a well formated code, something really important in code bases like python. From my PoV moving to ruff is a win-win approach, great to see that companies so big like Yelp has people focus on this changes for their code bases.

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.

3 participants