Skip to content

Commit c335fc3

Browse files
committed
Merge
2 parents 08e45c6 + a67a3b5 commit c335fc3

17 files changed

Lines changed: 218 additions & 142 deletions

File tree

.github/dependabot.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ updates:
66

77
# Update GitHub Actions of both the template and the repo
88
- package-ecosystem: github-actions
9+
cooldown:
10+
default-days: 7
911
directories:
10-
- "/"
11-
schedule:
12-
interval: daily
13-
14-
- package-ecosystem: github-actions
15-
directories:
16-
- "{{cookiecutter.project_slug}}/.github/workflows"
12+
- "/"
13+
- "{{cookiecutter.project_slug}}/.github/workflows"
14+
groups:
15+
actions:
16+
patterns:
17+
- "*"
1718
schedule:
1819
interval: daily

.github/workflows/tests.yml

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ jobs:
1212
self-test:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
15+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
1616
with:
1717
persist-credentials: false
1818

1919
- name: Install uv
20-
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
20+
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
2121
with:
2222
cache-dependency-glob: cookiecutter.json
2323

@@ -35,14 +35,13 @@ jobs:
3535
3636
cd /tmp/python-project
3737
git init . && git add . && git commit -m "Initial commit"
38-
make dev
39-
make reformat
38+
make format
4039
41-
git diff --exit-code || { >&2 echo "please reformat"; exit 1; }
40+
git diff --exit-code || { >&2 echo "please format"; exit 1; }
4241
4342
make lint
4443
make test
45-
make package
44+
make build
4645
make doc
4746
cd .. && rm -rf /tmp/python-project
4847
@@ -54,14 +53,13 @@ jobs:
5453
5554
cd /tmp/python-project
5655
git init . && git add . && git commit -m "Initial commit"
57-
make dev
58-
make reformat
56+
make format
5957
60-
git diff --exit-code || { >&2 echo "please reformat"; exit 1; }
58+
git diff --exit-code || { >&2 echo "please format"; exit 1; }
6159
6260
make lint
6361
make test
64-
make package
62+
make build
6563
make doc
6664
cd .. && rm -rf /tmp/python-project
6765
@@ -73,14 +71,13 @@ jobs:
7371
7472
cd /tmp/tob-r-and-e-python-project
7573
git init . && git add . && git commit -m "Initial commit"
76-
make dev
77-
make reformat
74+
make format
7875
79-
git diff --exit-code || { >&2 echo "please reformat"; exit 1; }
76+
git diff --exit-code || { >&2 echo "please format"; exit 1; }
8077
8178
make lint
8279
make test
83-
make package
80+
make build
8481
make doc
8582
cd .. && rm -rf /tmp/tob-r-and-e-python-project
8683
@@ -92,14 +89,13 @@ jobs:
9289
9390
cd /tmp/bit-trails
9491
git init . && git add . && git commit -m "Initial commit"
95-
make dev
96-
make reformat
92+
make format
9793
98-
git diff --exit-code || { >&2 echo "please reformat"; exit 1; }
94+
git diff --exit-code || { >&2 echo "please format"; exit 1; }
9995
10096
make lint
10197
make test
102-
make package
98+
make build
10399
make doc
104100
cd .. && rm -rf /tmp/bit-trails
105101
@@ -112,13 +108,12 @@ jobs:
112108
113109
cd /tmp/python-project
114110
git init . && git add . && git commit -m "Initial commit"
115-
make dev
116-
make reformat
111+
make format
117112
118-
git diff --exit-code || { >&2 echo "please reformat"; exit 1; }
113+
git diff --exit-code || { >&2 echo "please format"; exit 1; }
119114
120115
make lint
121116
make test
122-
make package
117+
make build
123118
make doc
124119
cd .. && rm -rf /tmp/python-project

.github/workflows/zizmor.yml

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,16 @@ permissions: {}
1010

1111
jobs:
1212
zizmor:
13-
name: zizmor latest via PyPI
1413
runs-on: ubuntu-latest
1514
permissions:
16-
security-events: write # needed by upload-sarif for all repositories
15+
security-events: write
16+
contents: read # only needed for private repos
17+
actions: read # only needed for private repos
1718
steps:
1819
- name: Checkout repository
19-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
2021
with:
2122
persist-credentials: false
2223

23-
- name: Install the latest version of uv
24-
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
25-
2624
- name: Run zizmor 🌈
27-
# Run it for both this repo and the templated cookiecutter repo.
28-
run: uvx zizmor --format sarif . {{cookiecutter.project_slug}}/.github/workflows > results.sarif
29-
env:
30-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31-
32-
- name: Upload SARIF file
33-
uses: github/codeql-action/upload-sarif@51f77329afa6477de8c49fc9c7046c15b9a4e79d # v3.29.5
34-
with:
35-
sarif_file: results.sarif
36-
category: zizmor
25+
uses: zizmorcore/zizmor-action@e639db99335bc9038abc0e066dfcd72e23d26fb4 # v0.3.0

AGENTS.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# AGENTS.md
2+
3+
## Project Overview
4+
5+
A Cookiecutter template for Python packages, supporting both CLI and library project types. Generates projects with uv, ruff, pyright, and pytest pre-configured. It also comes with GitHub Actions workflows configured for the project.
6+
7+
This template is opinionated and enforces recommended practices when creating new Python projects.
8+
9+
## Repository Structure
10+
11+
- `{{cookiecutter.project_slug}}/` - Template directory (rendered by Cookiecutter)
12+
- `cookiecutter.json` - Template variables and prompts
13+
- `hooks/` - Pre/post generation scripts
14+
- `pre_gen_project.py` - Validates inputs (namespace, slug, entry point)
15+
- `post_gen_project.py` - Cleans up unused files based on options
16+
17+
## Key Template Variables
18+
19+
| Variable | Purpose |
20+
|----------|---------|
21+
| `project_name` | Human-readable name |
22+
| `project_slug` | Pip/repo name (auto-derived) |
23+
| `project_namespace_import` | Optional namespace (e.g., `company.tools`) |
24+
| `repo_type` | `CLI` or `library` |
25+
| `entry_point` | CLI command name (CLI only) |
26+
27+
## Testing Changes
28+
29+
Generate a test project to verify template changes:
30+
31+
```bash
32+
# Generate in temp directory
33+
uvx cookiecutter -o /tmp .
34+
35+
# Or with specific options (no prompts)
36+
uvx cookiecutter --no-input -o /tmp . project_name="Test Project" repo_type="CLI"
37+
```
38+
39+
Then verify the generated project:
40+
41+
```bash
42+
cd /tmp/test-project
43+
make lint && make test
44+
```
45+
46+
## Verification
47+
48+
When modifying the template:
49+
50+
1. Ensure Jinja2 syntax is valid in template files
51+
2. Test both `CLI` and `library` repo types
52+
3. Test with and without `project_namespace_import`
53+
4. Verify generated project passes `make lint && make test`
54+
55+
## Commit Messages
56+
57+
- Summary line: max 50 chars (hard limit 72)
58+
- Body lines: max 72 chars
59+
- Use Markdown formatting in description

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@AGENTS.md

{{cookiecutter.project_slug}}/.github/dependabot.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
version: 2
22

33
updates:
4-
- package-ecosystem: pip
4+
- package-ecosystem: uv
5+
cooldown:
6+
default-days: 7
57
directory: /
68
groups:
79
python:
@@ -11,6 +13,8 @@ updates:
1113
interval: daily
1214

1315
- package-ecosystem: github-actions
16+
cooldown:
17+
default-days: 7
1418
directory: /
1519
groups:
1620
actions:

{{cookiecutter.project_slug}}/.github/workflows/docs.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,22 @@ permissions: {}
1010
jobs:
1111
build:
1212
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read # needed for private repos
1315
steps:
14-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
16+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
1517
with:
1618
persist-credentials: false
1719

1820
- name: Install uv
19-
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
20-
21-
- name: setup
22-
run: |
23-
make dev INSTALL_EXTRA=doc
21+
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
2422

2523
- name: build docs
2624
run: |
2725
make doc
2826
2927
- name: upload docs artifact
30-
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
28+
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
3129
with:
3230
path: ./html/
3331

{{cookiecutter.project_slug}}/.github/workflows/lint.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ permissions: {}
1111
jobs:
1212
lint:
1313
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read # needed for private repos
1416
steps:
15-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
17+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
1618
with:
1719
persist-credentials: false
1820

1921
- name: Install uv
20-
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
22+
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
2123

2224
- name: lint
23-
run: make lint INSTALL_EXTRA=lint
25+
run: make lint

{{cookiecutter.project_slug}}/.github/workflows/release.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,21 @@ jobs:
1111
build:
1212
name: Build distributions
1313
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read # needed for private repos
1416
steps:
15-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
17+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
1618
with:
1719
persist-credentials: false
1820

1921
- name: Install uv
20-
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
22+
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
2123

2224
- name: Build distributions
23-
run: uv build
25+
run: make build
2426

2527
- name: Upload distributions
26-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
28+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
2729
with:
2830
name: distributions
2931
path: dist/
@@ -37,12 +39,12 @@ jobs:
3739
attestations: write # To persist the attestation files.
3840
steps:
3941
- name: Download distributions
40-
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
42+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
4143
with:
4244
name: distributions
4345
path: dist/
4446
- name: Generate build provenance
45-
uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2.4.0
47+
uses: actions/attest-build-provenance@977bb373ede98d70efdf65b84cb5f73e068dcc2a # v3
4648
with:
4749
subject-path: 'dist/*'
4850

@@ -59,12 +61,12 @@ jobs:
5961
id-token: write
6062
steps:
6163
- name: Download distributions
62-
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
64+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
6365
with:
6466
name: distributions
6567
path: dist/
6668

6769
- name: Publish distributions
68-
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
70+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
6971
with:
7072
attestations: true

{{cookiecutter.project_slug}}/.github/workflows/tests.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,17 @@ jobs:
1919
- "3.13"
2020
- "3.14"
2121
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read # needed for private repos
2224
steps:
23-
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
2426
with:
2527
persist-credentials: false
2628

2729
- name: Install uv
28-
uses: astral-sh/setup-uv@e92bafb6253dcd438e0484186d7669ea7a8ca1cc # v6.4.3
29-
30-
- name: Install Python ${{ matrix.python }}
31-
run: uv python install ${{ matrix.python }}
30+
uses: astral-sh/setup-uv@1e862dfacbd1d6d858c55d9b792c756523627244 # v7.1.4
31+
with:
32+
python-version: ${{ matrix.python }}
3233

3334
- name: test
34-
run: make test INSTALL_EXTRA=test
35+
run: make test

0 commit comments

Comments
 (0)