Code Quality¶
Pre-commit¶
The template includes a .pre-commit-config.yaml with hooks that run automatically on each commit.
Active by default:
check-added-large-files— blocks files over 20MB (see Large File Protection below)
Commented out (opt-in):
trailing-whitespace,end-of-file-fixer,check-yaml— common housekeeping hooks- Ruff linting and formatting hooks (see Ruff below)
Setup¶
pre-commit install
Note: just install runs this automatically, so you likely already have it.
Manual run¶
To check all files (not just staged ones):
pre-commit run --all-files
See the pre-commit docs for more.
Ruff¶
The template uses Ruff for linting and formatting Python and Jupyter files.
Running Ruff¶
just ruff
This runs ruff check --fix followed by ruff format.
Enabling Ruff as a pre-commit hook¶
Uncomment the ruff-pre-commit section in .pre-commit-config.yaml:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.5
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
args: [--fix]
- id: ruff-format
types_or: [python, pyi, jupyter]
This applies Ruff automatically on every commit, covering both .py and .ipynb files.
Large File Protection¶
The check-added-large-files hook (active by default, 20MB limit) prevents accidentally committing data files to the repository. Data files belong in your data pipeline or object storage, not in git — they bloat the repo permanently and can't be fully removed without rewriting history.
If you hit the limit, add the file to .gitignore or store it outside the repo.