Open aqeelat opened 2 years ago
let's start with pre-commit (black, flack8, isort and pyupgrade too), here what I have in my private projects:
exclude: "^docs/|/migrations/"
default_stages: [commit]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- repo: https://github.com/asottile/pyupgrade
rev: v2.32.0
hooks:
- id: pyupgrade
args: ["--py3-plus"]
- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8
args: ["--config=setup.cfg"]
additional_dependencies: [flake8-isort]
# sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date
ci:
autoupdate_schedule: weekly
skip: []
submodules: false
and setup.cfg:
[flake8]
max-line-length = 120
exclude = .tox,.git,*/migrations/*,docs
[isort]
# This is the config for the isort import sorting tool.
# https://github.com/timothycrosley/isort/
# isort also informs flake8 linting via the flake8-isort library.
skip_glob = **/migrations/*.py
What do you think about using poetry in the project?
Also, what do you think about using a pre-commit to enforce a coding style such as Black?