Skip to content

Commit

Permalink
Replace flake8/isort/black with ruff.
Browse files Browse the repository at this point in the history
[Ruff](https://github.com/astral-sh/ruff) is a newer project from only a few
years ago that does all the things flake8/isort/black does, but in one package,
and is much faster. I think standardizing on ruff for new projects would help
have less tools to run and set up, and also reduce cycle time by making it run
anywhere from slightly to much faster than flake8 depending on the size of the
project.
  • Loading branch information
voidlily committed Apr 25, 2024
1 parent 83f79a7 commit cfd96f4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions content/engineering/languages-runtimes/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,17 @@ Finally, in an effort to ensure our deployments are repeatable, our code **stand
(though this is only a partial solution)

## Style
Our **standard** tool for ensuring consistency across Python code bases is [flake8](http://flake8.pycqa.org/en/latest/). Its **default** settings are a good first step, as is using its [integration with isort](https://pypi.python.org/pypi/flake8-isort) for import order. We **suggest** investigating flake8's [plugin ecosystem](https://pypi.python.org/pypi?%3Aaction=search&term=flake8&submit=search) for more functionality.

Use [Black](https://black.readthedocs.io/en/stable/) for automatic code formatting.
Our **standard** tool for ensuring consistency across Python code bases is
[Ruff](https://github.com/astral-sh/ruff). Its **default** settings are a good
first step.

It includes syntax checking (previously under
[flake8](http://flake8.pycqa.org/en/latest/)), import ordering (previously under
[isort](https://pypi.python.org/pypi/flake8-isort)), and automatic code
formatting (same defaults as [Black](https://black.readthedocs.io/en/stable/)),
but all in one package and runs much faster than previous programs. In older
projects these tools may still be being used.

Using Code Climate to measure complexity scores (by way of [radon](https://pypi.python.org/pypi/radon)) is also a reasonable **default** to ensure you see potentially confounding functions and classes.

Expand Down

0 comments on commit cfd96f4

Please sign in to comment.