Skip to content

Commit 66430ab

Browse files
author
Daniel Goshev
committed
Update README.
1 parent 326c072 commit 66430ab

File tree

1 file changed

+7
-42
lines changed

1 file changed

+7
-42
lines changed

README.md

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -388,61 +388,26 @@ _Coming soon_
388388

389389
In all our Django projects we use:
390390

391-
- [flake8](https://flake8.pycqa.org/en/latest/) - a linter that ensures we follow the PEP8 conventions.
392-
- [black](https://github.com/psf/black) - a code formatter that ensures we have the same code style everywhere.
393-
- [isort](https://github.com/PyCQA/isort) - a code formatter that ensures we have the same import style everywhere.
391+
- [ruff](https://docs.astral.sh/ruff/) - an extremely fast Python linter and code formatter, written in Rust.
394392
- [pre-commit](https://pre-commit.com/) - a tool that triggers the linters before each commit.
395393

396394
To make sure all of the above tools work in symbiosis, you'd need to add some configuration:
397395

398396
1. Add `.pre-commit-config.yaml` file to the root of your project. There you can add the instructions for `pre-commit`
399-
2. Add `pyproject.toml` file to the root of your project. There you can add the `black` config. **NOTE:** `black` [does not respect any other config files.](https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html)
400-
3. Add the following to `setup.cfg` for the `isort` config:
401-
402-
```
403-
[isort]
404-
profile = black
405-
```
406-
407-
This will tell `isort` to follow the `black` guidelines.
408-
409-
```
410-
[isort]
411-
filter_files = true
412-
skip_glob = */migrations/*
413-
```
414-
415-
This will tell `pre-commit` to respect the `isort` config.
416-
417-
4. You can add a custom `flake8` configuration to `setup.cfg` as well. We usually have the following config in all our projects:
418-
419-
```
420-
[flake8]
421-
max-line-length = 120
422-
extend-ignore = E203
423-
exclude =
424-
.git,
425-
__pycache__,
426-
*/migrations/*
427-
```
428-
429-
5. Make sure the linters are run against each PR on your CI. This is the config you need if you use GH actions:
397+
2. Add `pyproject.toml` file to the root of your project. There you can add the `ruff` config.
398+
3. Make sure the linters are run against each PR on your CI. This is the config you need if you use GH actions:
430399

431400
```
432401
build:
433402
runs-on: ubuntu-latest
434403
steps:
435-
- name: Run isort
436-
uses: isort/isort-action@master
437-
- name: Run black
438-
uses: psf/black@stable
439-
- name: Run flake8
440-
run: flake8
404+
- name: Run ruff
405+
uses: chartboost/ruff-action@v1
441406
```
442407

443-
6. Last but not least, we highly recommend you to setup you editor to run `black` and `isort` every time you save a new Python file.
408+
4. Last but not least, we highly recommend you to setup you editor to run `ruff` every time you save a new Python file.
444409

445410
In order to test if your local setup is up to date, you can either:
446411

447412
1. Try making a commit, to see if `pre-commit` is going to be triggered.
448-
1. Or run `black --check .` and `isort --check .` in the project root directory.
413+
2. Or run `ruff check .` in the project root directory.

0 commit comments

Comments
 (0)