@@ -19,7 +19,7 @@ Every project generated from this template includes:
1919| Linting | Ruff | Catches bugs, bad patterns, unused imports |
2020| Type checking | Mypy | Catches type errors before runtime |
2121| Testing | pytest + pytest-cov | Runs tests with coverage reporting |
22- | Git hooks | pre-commit | Runs checks automatically on every commit |
22+ | Git hooks | pre-commit | Runs Ruff automatically on every commit |
2323| CI/CD | GitHub Actions | Runs lint, type check, and tests on push/PR |
2424| Branch strategy | three-tier | main / uat / dev enforced in CI |
2525| GitHub templates | PR + Issue | Standardised PR and issue descriptions |
@@ -116,10 +116,10 @@ Copier asks a series of questions to configure your project. Each question
116116has a default value -- press Enter to accept it, or type your own answer.
117117```
118118Project name (e.g. inflation-db)
119- > inflation-analysis
119+ > inflation-db
120120
121121Python package name
122- > inflation_analysis
122+ > inflation_db
123123
124124Author name
125125> Kyle Ferreira
@@ -128,10 +128,10 @@ Author email
128128> kyle.fe0212@gmail.com
129129
130130Python version
131- > 3.13
131+ > 3.11
132132
133133Short project description
134- > Analysis of exchange rate pass-through to local core inflation
134+ > A macroeconomic inflation database
135135
136136License (MIT / Apache-2.0 / Proprietary)
137137> MIT
@@ -162,19 +162,19 @@ Two of the prompts can be confusing at first:
162162the folder name, ` pyproject.toml ` , ` README.md ` , and documentation. It
163163typically uses hyphens as separators.
164164```
165- Example: inflation-analysis
165+ Example: inflation-db
166166```
167167
168168** Python package name** is the importable name of your package in Python
169169code -- the name you use in ` import ` statements. Python package names cannot
170170contain hyphens, so they use underscores instead. Copier auto-suggests this
171171by converting your project name, so you usually just press Enter to accept it.
172172```
173- Example: inflation_analysis
173+ Example: inflation_db
174174
175175# This is what gets used in code:
176- from inflation_analysis import something
177- import inflation_analysis
176+ from inflation_db import something
177+ import inflation_db
178178```
179179
180180As a rule: project name uses hyphens (how humans refer to it), package name
@@ -234,7 +234,7 @@ poetry run pre-commit install
234234```
235235
236236This activates the pre-commit hooks so that every time you run ` git commit ` ,
237- Ruff and Mypy run automatically and block the commit if there are any issues.
237+ Ruff runs automatically and blocks the commit if there are any lint issues.
238238You only need to run this once per project, immediately after ` git init ` .
239239
240240### Step 7 -- Confirm everything is working
@@ -405,24 +405,27 @@ the first time, or after pulling changes that added new dependencies to
405405` pyproject.toml ` . It installs everything into ` .venv/ ` and updates
406406` poetry.lock ` .
407407``` bash
408- make lint
409- ```
410- Runs ` ruff check . ` . Scans all Python files for code quality issues --
411- unused imports, bad patterns, style violations. Does not modify any files,
412- only reports problems. Use this to see what needs fixing before committing.
413- ``` bash
414408make format
415409```
416410Runs ` ruff format . ` . Automatically rewrites your Python files to conform
417411to the project's style rules -- indentation, line length, quote style, etc.
418- Run this before committing to ensure consistent formatting.
412+ Always run ` make format ` before ` git add ` and ` git commit ` . This ensures
413+ your code is formatted before the pre-commit hooks run, avoiding the common
414+ situation where a hook auto-fixes a file mid-commit and blocks it.
415+ ``` bash
416+ make lint
417+ ```
418+ Runs ` ruff check . ` . Scans all Python files for code quality issues --
419+ unused imports, bad patterns, style violations. Does not modify any files,
420+ only reports problems. Run this after ` make format ` to catch any remaining
421+ issues before committing.
419422``` bash
420423make typecheck
421424```
422425Runs ` mypy src ` . Statically analyses your code for type errors without
423426executing it. Catches bugs like passing the wrong type to a function before
424- they cause a runtime failure. Run this after writing new code or updating
425- function signatures .
427+ they cause a runtime failure. Mypy runs in CI on every push -- run it
428+ locally when you want early feedback on type correctness .
426429``` bash
427430make test
428431```
@@ -436,6 +439,12 @@ make ci
436439Runs lint, format check, typecheck, and test in sequence. This mirrors
437440exactly what GitHub Actions runs on every push. If ` make ci ` passes locally,
438441your push will pass CI. Run this before pushing to catch issues early.
442+ ``` bash
443+ make pre-commit
444+ ```
445+ Runs all pre-commit hooks manually across every file in the project. Useful
446+ for checking what the hooks will do before making a commit, or for applying
447+ hook fixes to files you have not staged yet.
439448
440449---
441450
@@ -453,31 +462,56 @@ make install
453462``` bash
454463# After writing a new function or module
455464make typecheck # catch type errors immediately
465+ make test # confirm nothing is broken
466+ ```
456467
457- # Before committing
458- make format # auto-fix formatting
468+ ** Before every commit -- always follow this order**
469+ ``` bash
470+ make format # auto-fix formatting first
459471make lint # check for any remaining issues
460- make test # confirm nothing is broken
472+ git add .
473+ git commit -m " feat: describe what you did"
461474```
462475
476+ Running ` make format ` before ` git add ` is important. The pre-commit hooks
477+ run Ruff automatically on commit -- if Ruff finds formatting issues it
478+ auto-fixes them and blocks the commit, requiring you to ` git add ` and
479+ commit again. Running ` make format ` first eliminates this by ensuring your
480+ code is already formatted before the hooks fire.
481+
463482** Before pushing or opening a PR**
464483``` bash
465484# Run the full suite to confirm everything passes
466485make ci
486+ git push
467487```
468488
469489** Typical commit rhythm**
470490``` bash
471- make format # fix formatting automatically
472- make ci # confirm everything passes
491+ make format # fix formatting first
492+ make lint # confirm clean
473493git add .
474494git commit -m " feat: describe what you did"
495+ make ci # full check before pushing
475496git push
476497```
477498
478- The pre-commit hooks will also run Ruff and Mypy automatically on
479- ` git commit ` , so ` make format ` and ` make lint ` act as a first pass before
480- the hooks fire.
499+ ---
500+
501+ ## Pre-commit hooks vs CI
502+
503+ This template separates concerns deliberately:
504+
505+ ** Pre-commit hooks (run locally on every commit):**
506+ - Ruff lint and format -- fast, catches style issues immediately
507+ - Standard file checks -- trailing whitespace, end of file, yaml validity
508+
509+ ** CI only (runs on GitHub on every push/PR):**
510+ - Mypy type checking -- thorough but slow, better as a gate than a blocker
511+ - Full test suite with coverage
512+
513+ This means local commits are fast and rarely blocked, while GitHub Actions
514+ acts as the strict quality gate before code reaches ` main ` or ` uat ` .
481515
482516---
483517
0 commit comments