https://github.com/larsrollik/templatepy
Template repository for best-practice Python packages
https://github.com/larsrollik/templatepy
build-system bumpversion community linting package pre-commit pypi python template zenodo zenodo-upload
Last synced: 27 days ago
JSON representation
Template repository for best-practice Python packages
- Host: GitHub
- URL: https://github.com/larsrollik/templatepy
- Owner: larsrollik
- Created: 2021-05-24T20:01:57.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2026-05-23T23:06:34.000Z (27 days ago)
- Last Synced: 2026-05-23T23:10:28.321Z (27 days ago)
- Topics: build-system, bumpversion, community, linting, package, pre-commit, pypi, python, template, zenodo, zenodo-upload
- Language: Python
- Homepage:
- Size: 847 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Citation: CITATION.cff
Awesome Lists containing this project
README
# templatepy
[](https://doi.org/10.5281/zenodo.20360320)
Copier template for modern Python packages.
**[→ Full documentation](https://larsrollik.github.io/templatepy)**
## Stack
| Tool | Role |
|---|---|
| uv | dependency management, virtual environments |
| hatchling + hatch-vcs | build backend; version from git tags |
| commitizen | Conventional Commits enforcement; auto bump on merge |
| ruff | linting + formatting |
| mypy | static type checking |
| pytest + pytest-cov | testing with coverage |
| gitleaks | secret scanning |
## Quickstart
```sh
uv tool install copier
copier copy gh:larsrollik/templatepy my-new-project
cd my-new-project
git init && git add -A && git commit -m "chore: initial commit from templatepy"
uv sync --extra dev
uv run pre-commit install --hook-type pre-commit --hook-type commit-msg
```
## Update existing project
```sh
cd my-existing-project && copier update
```
## Release flow
```
feature branch → PR → CI gate (lint + test + secrets) must pass
merge blocked until green
↓
merge to main (rebase)
↓
bump.yml fires: cz bump → tag vX.Y.Z
↓
release.yml fires on tag:
→ GitHub release (wheel + sdist attached)
→ PyPI via OIDC trusted publishing (no stored token)
→ Zenodo webhook (if enabled)
```
## PyPI setup (one-time per repo)
Uses OIDC trusted publishing — no API token stored in GitHub secrets.
1. pypi.org → project → Settings → Publishing → Add trusted publisher
2. Owner: ``, Repository: ``, Workflow: `release.yml`
3. Done — the workflow handles authentication automatically.
## Branch protection (required for CI gate)
Repo settings → Branches → Add rule for `main`:
- ✅ Require status checks: `CI` job
- ✅ Require branches to be up to date
- ✅ Require linear history
For the auto-bump workflow to push the bump commit back to main:
- ✅ Allow specified actors to bypass → add `github-actions[bot]`
## Docs
```sh
uv run mkdocs serve
```
Deploy to GitHub Pages on push to main via `docs.yml` (automatic).