Git Pre-commit Hooks

Pre-commit hooks run quality checks before Git creates a commit. They give the author fast feedback and prevent avoidable formatting or test failures from reaching the shared branch.

Configure the hooks

The example configures these hooks:

  • whitespace checks and YAML validation.
  • large-file checks and import sorting.
  • Black, Pylint, and pytest.

Keep the configuration in the repository so every contributor can install the same hooks.

The pre-commit script and hook configuration

Install the hooks with pre-commit install, then run all hooks once with pre-commit run --all-files. A commit should fail when a hook finds a problem, giving the author a chance to fix it before the commit is created.

A pre-commit configuration in the project

Hooks are a local safety net, not a replacement for CI. Run the same checks in the CI workflow so a contributor who skipped local hooks can't bypass the project's quality gate.

Optional analytics

Optional analytics are off unless you allow them. Your choice does not affect access to DataTalks.Club, Slack, events, or courses.

Current choice: not chosen.

Privacy Policy

If you allow analytics, self-hosted Umami counts anonymous public pageviews without analytics cookies. Private account and learning pages are excluded. Read the Privacy Policy for the complete data boundary.