|
1 | 1 | # python-template |
| 2 | + |
| 3 | +A minimal Python template with strict defaults for projects that want to stay small, typed, and |
| 4 | +easy to maintain. |
| 5 | + |
| 6 | +## What this template includes |
| 7 | + |
| 8 | +- `uv` for dependency and lockfile management |
| 9 | +- `src/` layout with Hatchling-based packaging |
| 10 | +- Click-powered CLI entry point |
| 11 | +- Ruff, Pyright, and pytest configured as the default quality bar |
| 12 | +- GitHub Actions for CI, build validation, and tag-based release artifacts |
| 13 | + |
| 14 | +## Quickstart |
| 15 | + |
| 16 | +```bash |
| 17 | +uv sync --group dev |
| 18 | +make check |
| 19 | +python -m python_template --help |
| 20 | +``` |
| 21 | + |
| 22 | +## Core commands |
| 23 | + |
| 24 | +| Command | Purpose | |
| 25 | +| --- | --- | |
| 26 | +| `make setup` | Install runtime dependencies | |
| 27 | +| `make setup-dev` | Install runtime and development dependencies | |
| 28 | +| `make format` | Format the codebase with Ruff | |
| 29 | +| `make lint` | Run Ruff lint checks | |
| 30 | +| `make lint-fix` | Run Ruff and apply safe fixes | |
| 31 | +| `make typecheck` | Run Pyright in strict mode | |
| 32 | +| `make test` | Run pytest | |
| 33 | +| `make test-cov` | Run pytest with coverage | |
| 34 | +| `make check` | Run format, lint, typecheck, and tests | |
| 35 | +| `make build` | Build the wheel and sdist | |
| 36 | +| `make lock` | Refresh `uv.lock` without upgrading | |
| 37 | +| `make update` | Upgrade dependencies and refresh `uv.lock` | |
| 38 | + |
| 39 | +## Project layout |
| 40 | + |
| 41 | +```text |
| 42 | +. |
| 43 | +├── .github/workflows/ |
| 44 | +├── src/python_template/ |
| 45 | +├── tests/ |
| 46 | +├── .pre-commit-config.yaml |
| 47 | +├── Makefile |
| 48 | +├── pyproject.toml |
| 49 | +└── uv.lock |
| 50 | +``` |
| 51 | + |
| 52 | +## Quality defaults |
| 53 | + |
| 54 | +This template is intentionally strict: |
| 55 | + |
| 56 | +- **Ruff** enforces formatting, imports, docstrings, naming, typing hygiene, and common bug-prone |
| 57 | + patterns. |
| 58 | +- **Pyright** runs in `strict` mode. |
| 59 | +- **pytest** is the default regression layer. |
| 60 | + |
| 61 | +The goal is to start from a clean baseline and relax rules only when a real project constraint |
| 62 | +demands it. |
| 63 | + |
| 64 | +## GitHub Actions |
| 65 | + |
| 66 | +The repository ships with three small workflows: |
| 67 | + |
| 68 | +- `ci.yml` — lint, typecheck, and test on Python 3.11–3.13 |
| 69 | +- `build.yml` — build the package and smoke-test the generated wheel |
| 70 | +- `release.yml` — build and upload release artifacts for version tags |
| 71 | + |
| 72 | +## License |
| 73 | + |
| 74 | +MIT. |
0 commit comments