- Add the above files
pyproject.toml
and.pre-commit-config.yaml
at the root of your repo - Add ruff and pre-commit dependencies
poetry add --group dev ruff
poetry add --group dev pre-commit
- On commit, actions will be auto-triggered
- Before commit, you can verify if things work as expected using
ruff check . # run ruff linter alone
ruff format . # run ruff formatter alone
- Add to
ignore
list if you don't need a certain rule - Check how all actions would run altogether on commit using
pre-commit run --all-files # manually run all precommit actions on all files
pre-commit run --files=$FILES # specify files to run
pre-commit run --all-files ruff # run only ruff
Make sure to run pre-commit install right after you clone
git clone your_awesome_python_repo
# Setup dependencies
poetry install
# Setup pre-commit hooks
pre-commit install