Stop relying on discipline: Pre-commit hooks that catch Django problems early
Speaker: Mohammad Abu Khashabeh
Has a manage.py check failure ever reached your staging environment? Or a migration that was written but never applied? Pre-commit hooks turn these from “we’ll catch it in CI” into “the commit is blocked until it’s fixed.” This talk gives you a complete, layered stack: generic hooks, then pyupgrade, black, isort, autoflake, flake8, bandit, mypy — plus exclusions for migrations and tests, and how to add manage.py check as a local hook. Copy-paste friendly, works in legacy codebases, and you leave with a config you can use that afternoon.
Pre-commit hooks are not magic — they are a gate, and gates only work when you put them in the right place. This talk walks through the full mental model: what to run on every commit, what belongs in CI instead, and why the order of hooks matters.
We cover the stack from generic repo hygiene (whitespace, merge markers, secrets detection) through Python formatting and linting, to Django-specific local hooks that run manage.py check — and optionally your tests — before any commit lands. We also cover incremental adoption: how to introduce this into a legacy Django codebase without breaking the team’s flow. Every hook comes with its exclusion rationale, including why migrations are excluded from mypy and why tests get different linting rules.
About Mohammad
TBD