Skip to content

Commit 11cf951

Browse files
committed
Create copier-python project template
1 parent b304fd3 commit 11cf951

80 files changed

Lines changed: 7560 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.copier-answers.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Changes here will be overwritten by Copier
2+
_commit: 566d4ed
3+
_src_path: .
4+
copyright_holder: Stephen Kent
5+
copyright_holder_email: smkent@smkent.net
6+
copyright_license: MIT
7+
copyright_year: '2026'
8+
enable_container: false
9+
enable_coverage: true
10+
enable_docs: true
11+
enable_pypi: true
12+
github_user: smkent
13+
project_description: Copier template for Python projects with modern tooling
14+
project_name: copier-python
15+
project_slug: copier_python
16+
project_type: library
17+
project_visibility: public
18+
python_version_minimum: '3.10'
19+
user_email: smkent@smkent.net
20+
user_name: Stephen Kent

.github/workflows/audit.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Audit
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- uv.lock
8+
pull_request:
9+
paths:
10+
- uv.lock
11+
12+
jobs:
13+
audit:
14+
name: Dependencies
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: 💾 Check out repository
18+
uses: actions/checkout@v4
19+
20+
- name: 🦀 Set up Python project with uv
21+
uses: astral-sh/setup-uv@v5
22+
with:
23+
enable-cache: true
24+
python-version: '3.14'
25+
26+
- name: 🐍 Install dependencies
27+
run: uv sync
28+
29+
- name: 🔍 Check dependencies
30+
run: uv run poe audit

.github/workflows/ci.yaml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
12+
13+
jobs:
14+
ci:
15+
name: Test (Python ${{ matrix.python-version }})
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
python-version:
21+
- '3.10'
22+
- '3.11'
23+
- '3.12'
24+
- '3.13'
25+
- '3.14'
26+
steps:
27+
- name: 💾 Check out repository
28+
uses: actions/checkout@v4
29+
30+
- name: 🪪 Configure git identity for tests
31+
run: |
32+
git config --global user.name "github-actions[bot]"
33+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
34+
35+
- name: 🦀 Set up Python project with uv
36+
uses: astral-sh/setup-uv@v5
37+
with:
38+
enable-cache: true
39+
python-version: ${{ matrix.python-version }}
40+
41+
- name: 🐍 Install dependencies
42+
run: uv sync
43+
44+
- name: 📐 Lint
45+
run: uv run poe lint
46+
47+
- name: 🔥 Test
48+
run: uv run poe test
49+
50+
- name: 🔍 Collect coverage results
51+
run: uv run coverage xml
52+
if: ${{ matrix.python-version == '3.14' }}
53+
54+
- name: 📊 Upload coverage to Codecov
55+
uses: codecov/codecov-action@v6
56+
if: ${{ matrix.python-version == '3.14' }}
57+
with:
58+
fail_ci_if_error: true
59+
60+
docs:
61+
name: Documentation
62+
runs-on: ubuntu-latest
63+
steps:
64+
- name: 💾 Check out repository
65+
uses: actions/checkout@v4
66+
with:
67+
fetch-depth: 0
68+
69+
- name: 🦀 Set up Python project with uv
70+
uses: astral-sh/setup-uv@v5
71+
with:
72+
enable-cache: true
73+
python-version: '3.14'
74+
75+
- name: 🐍 Install dependencies
76+
run: uv sync
77+
78+
- name: 📖 Build documentation
79+
run: uv run poe docs-build
80+
81+
gitleaks:
82+
name: Secret scan
83+
runs-on: ubuntu-latest
84+
permissions:
85+
contents: read
86+
steps:
87+
- name: 💾 Check out repository
88+
uses: actions/checkout@v4
89+
with:
90+
fetch-depth: 0
91+
92+
- name: 🔍 Check for secrets
93+
uses: gitleaks/gitleaks-action@v2
94+
env:
95+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/docs.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: pages
16+
cancel-in-progress: false
17+
18+
jobs:
19+
build:
20+
name: Build Documentation
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: 💾 Check out repository
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: 🦀 Set up Python project with uv
29+
uses: astral-sh/setup-uv@v5
30+
with:
31+
enable-cache: true
32+
python-version: '3.14'
33+
34+
- name: 🐍 Install dependencies
35+
run: uv sync
36+
37+
- name: 📖 Build documentation
38+
run: uv run poe docs-build
39+
40+
- name: 🔼 Upload artifact
41+
uses: actions/upload-pages-artifact@v3
42+
with:
43+
path: site/
44+
45+
deploy:
46+
name: Deploy Documentation
47+
needs: build
48+
runs-on: ubuntu-latest
49+
environment:
50+
name: github-pages
51+
url: ${{ steps.deployment.outputs.page_url }}
52+
steps:
53+
- name: 🚀 Deploy site
54+
uses: actions/deploy-pages@v4
55+
id: deployment

.github/workflows/release.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '[0-9]*.[0-9]*'
7+
8+
jobs:
9+
build:
10+
name: Build distribution
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: 💾 Check out repository
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: 🦀 Set up Python project with uv
19+
uses: astral-sh/setup-uv@v5
20+
with:
21+
enable-cache: true
22+
python-version: '3.14'
23+
24+
- name: 📦 Build package
25+
run: uv build
26+
27+
- name: 🔼 Upload artifact
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: dist
31+
path: dist/
32+
33+
publish:
34+
name: Publish to PyPI
35+
needs: build
36+
runs-on: ubuntu-latest
37+
environment:
38+
name: pypi
39+
url: https://pypi.org/project/copier-python/
40+
permissions:
41+
id-token: write
42+
attestations: write
43+
contents: write
44+
steps:
45+
- name: 🔽 Download artifact
46+
uses: actions/download-artifact@v4
47+
with:
48+
name: dist
49+
path: dist/
50+
51+
- name: ☢️ Publish to PyPI
52+
uses: pypa/gh-action-pypi-publish@release/v1
53+
with:
54+
attestations: true
55+
56+
- name: 🏷️ Create GitHub release
57+
run: gh release create ${{ github.ref_name }} dist/* --generate-notes
58+
env:
59+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Python
2+
__pycache__/
3+
*.egg-info/
4+
*.py[cod]
5+
6+
# uv and packaging
7+
.venv/
8+
/build/
9+
/dist/
10+
uv.lock
11+
12+
# Development tools
13+
.cache/
14+
.coverage*
15+
.pytest_cache/
16+
.ruff_cache/
17+
/htmlcov/
18+
/site/
19+
coverage.xml

.pre-commit-config.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
exclude: \.ambr$
7+
- id: end-of-file-fixer
8+
exclude: \.ambr$
9+
- id: check-merge-conflict
10+
- id: check-yaml
11+
- id: check-toml
12+
- id: check-json
13+
- id: check-added-large-files
14+
- id: detect-private-key
15+
- id: debug-statements
16+
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
17+
rev: v2.16.0
18+
hooks:
19+
- id: pretty-format-yaml
20+
args: [--autofix, --offset, '2']
21+
exclude: ^/.copier-.*.yml$
22+
- repo: https://github.com/gitleaks/gitleaks
23+
rev: v8.21.2
24+
hooks:
25+
- id: gitleaks
26+
- repo: local
27+
hooks:
28+
- id: ruff
29+
name: ruff
30+
entry: uv run ruff check --fix
31+
language: system
32+
types_or: [python, pyi]
33+
- id: ruff-format
34+
name: ruff-format
35+
entry: uv run ruff format
36+
language: system
37+
types_or: [python, pyi]
38+
- id: ty
39+
name: ty
40+
entry: uv run ty check
41+
language: system
42+
types: [python]
43+
pass_filenames: false

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
[Unreleased]: https://github.com/smkent/copier-python/commits/main/

CONTRIBUTING.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Contributing to copier-python
2+
3+
## Development setup
4+
5+
### Prerequisites
6+
7+
- [Astral's **uv** Python project manager][uv]
8+
- [`poethepoet`][poe] task runner: `uv tool install poethepoet`
9+
10+
### Project setup
11+
12+
```sh
13+
git clone https://github.com/smkent/copier-python
14+
cd copier-python
15+
uv sync
16+
uv run poe setup # Enables pre-commit hooks
17+
```
18+
19+
## Common tasks
20+
21+
| Command | Description |
22+
|---|---|
23+
| `poe docs` | Run documentation server locally |
24+
| `poe lint` | Run all formatters and static checks |
25+
| `poe lt` | Run all formatters, static checks and tests (`lint` and `test`) |
26+
| `poe snapup` | Update test snapshots |
27+
| `poe test` | Run tests |
28+
29+
[poe]: https://poethepoet.naln1.net/
30+
[uv]: https://docs.astral.sh/uv/

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Stephen Kent
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)