Skip to content

Commit 5ae9013

Browse files
committed
Add opt-out for documentation and release workflows
1 parent a08bd0f commit 5ae9013

10 files changed

Lines changed: 60 additions & 11 deletions

‎copier.yml‎

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ _exclude:
1111
- "__pycache__"
1212
- ".git"
1313
- ".DS_Store"
14-
# Example code is only added on `copier copy`; `copier update` never adds it back
14+
# Example code is only added on `copier copy`; `copier update` never adds it back.
15+
# Docs and release files are also skipped when their option is off
1516
- "{% if _copier_operation == 'update' %}src/*/hello_world.py{% endif %}"
1617
- "{% if _copier_operation == 'update' %}tests/test_hello_world.py{% endif %}"
17-
- "{% if _copier_operation == 'update' %}scripts/sync-labels.sh{% endif %}"
18-
- "{% if _copier_operation == 'update' %}/docs{% endif %}"
19-
- "{% if _copier_operation == 'update' %}zensical.toml{% endif %}"
20-
- "{% if _copier_operation == 'update' %}.github/release-drafter.yml{% endif %}"
21-
- "{% if _copier_operation == 'update' %}.github/workflows/release-drafter.yml{% endif %}"
22-
- "{% if _copier_operation == 'update' %}.github/workflows/release.yml{% endif %}"
18+
- "{% if _copier_operation == 'update' or not use_releases %}scripts/sync-labels.sh{% endif %}"
19+
- "{% if _copier_operation == 'update' or not use_docs %}/docs{% endif %}"
20+
- "{% if _copier_operation == 'update' or not use_docs %}zensical.toml{% endif %}"
21+
- "{% if _copier_operation == 'update' or not use_releases %}.github/release-drafter.yml{% endif %}"
22+
- "{% if _copier_operation == 'update' or not use_releases %}.github/workflows/release-drafter.yml{% endif %}"
23+
- "{% if _copier_operation == 'update' or not use_releases %}.github/workflows/release.yml{% endif %}"
2324
_tasks:
2425
- uv lock
2526

@@ -43,3 +44,13 @@ github_repo:
4344
type: str
4445
help: GitHub owner/repo (used for the README badges)
4546
validator: "{% if github_repo.count('/') != 1 %}Use the owner/repo format{% endif %}"
47+
48+
use_docs:
49+
type: bool
50+
help: Include Zensical docs (docs/, zensical.toml, docs build in CI and hooks)?
51+
default: false
52+
53+
use_releases:
54+
type: bool
55+
help: Include Release Drafter, the manual release workflow, and release labels?
56+
default: false

‎justfile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ render:
1919
uvx copier copy --trust --defaults --vcs-ref HEAD \
2020
--data project_name=demo-project \
2121
--data github_repo=example-owner/demo-project \
22+
--data use_docs=true \
23+
--data use_releases=true \
2224
. {{ rendered }}
2325
# Install Homebrew tools from the Brewfile
2426
setup:

template/.github/pull_request_template.md renamed to template/.github/pull_request_template.md.jinja

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
## Related Issues
66

77
<!-- e.g. Closes #123 -->
8+
{%- if use_releases %}
89

910
## Type of Change
1011

@@ -17,11 +18,14 @@ Add a release label to this PR from the Labels section of the PR sidebar
1718
chore / ci / dependencies / documentation / refactor -> patch
1819
skip-changelog -> excluded from release notes
1920
-->
21+
{%- endif %}
2022

2123
## Checklist
2224

2325
- [ ] `just lint` passes
2426
- [ ] `just test` passes
2527
- [ ] Tests added or updated for the change
2628
- [ ] `README.md` updated if needed
29+
{%- if use_releases %}
2730
- [ ] Release label added
31+
{%- endif %}

template/.github/workflows/python.yml renamed to template/.github/workflows/python.yml.jinja

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{% raw -%}
12
name: Python CI Checks
23

34
on:
@@ -32,9 +33,11 @@ jobs:
3233
- name: Unit tests
3334
run: |
3435
just test
36+
{%- endraw %}{% if use_docs %}{% raw %}
3537
- name: Docs build
3638
run: |
3739
just docs-build
40+
{%- endraw %}{% endif %}{% raw %}
3841
markdownlint:
3942
runs-on: ubuntu-slim
4043
permissions:
@@ -48,3 +51,4 @@ jobs:
4851
uses: DavidAnson/markdownlint-cli2-action@21c1be1b93ad9ed58fa840aacc3f279cde2a72ff # v24.2.0
4952
with:
5053
globs: "**/*.md"
54+
{%- endraw %}

‎template/.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ dmypy.json
126126

127127
# Claude
128128
.claude/*.local.*
129+
Claude.md.example
130+
CLAUDE.md
129131

130132
# Dev Container
131133
.devcontainer/devcontainer-lock.json

‎template/CLAUDE.md.example.jinja‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ Uses `uv` for environment/dependency management and `just` as the command runner
1414
- `just test` - run pytest with coverage (fails under 98%)
1515
- `just audit` - check dependencies for known vulnerabilities (pip-audit)
1616
- `just markdownlint` - lint Markdown files (markdownlint-cli2, config in `.markdownlint-cli2.jsonc`)
17+
{%- if use_docs %}
1718
- `just docs-build` - build the docs with Zensical in strict mode (`zensical.toml`, pages in `docs/`)
1819
- `just docs-serve` - serve the docs locally with live reload
20+
{%- endif %}
1921
- `just zizmor` - audit GitHub Actions workflows for security issues
2022
- `just git-leaks` - scan staged changes for secrets
23+
{%- if use_releases %}
2124
- `just set-github-labels` - remove non-release default labels, then create/update the release labels on GitHub
2225
(`scripts/sync-labels.sh`, needs `gh`, for fresh repos)
26+
{%- endif %}
2327
- `uv add <pkg>` / `uv add --dev <pkg>` - add a runtime / dev dependency (never edit `uv.lock` by hand)
2428
- `uv run {{ project_name }}` - run the app entry point
2529

@@ -31,10 +35,10 @@ Run `just lint` and `just test` before considering a change done.
3135
- `src/{{ package_name }}/__init__.py` - `main()` entry point, exposed as the `{{ project_name }}` script
3236
- `tests/` - pytest tests; import the package as `from {{ package_name }}.<module> import ...`
3337
- `prek.toml` - git hook config (`prek install` to enable)
34-
- `.github/workflows/` - `python.yml` (lint, tests, docs build, markdownlint),
35-
`security.yml` (zizmor, gitleaks, pip-audit),
38+
- `.github/workflows/` - `python.yml` (lint, tests,{% if use_docs %} docs build,{% endif %} markdownlint),
39+
`security.yml` (zizmor, gitleaks, pip-audit){% if use_releases %},
3640
`release-drafter.yml` (draft release, PR labels), `release.yml` (manual release)
37-
- `.github/release-drafter.yml` - release label → version bump / release notes section mapping
41+
- `.github/release-drafter.yml` - release label → version bump / release notes section mapping{% endif %}
3842
- `.github/dependabot.yml` - weekly updates for actions, uv, dev container image and features
3943
- `.devcontainer/` - dev container; base image, `just`, and `uv` pinned by tag + digest
4044
- `scripts/` - repo maintenance scripts
@@ -46,7 +50,7 @@ Run `just lint` and `just test` before considering a change done.
4650
- Type hints on public functions; code must pass `ty check`
4751
- Renaming the project means updating `[project] name`, the `src/<name>/` folder, and `[project.scripts]` together
4852

49-
## CI, security, and releases
53+
## CI{% if use_releases %}, security, and releases{% else %} and security{% endif %}
5054

5155
- Pin GitHub Actions to a full commit SHA with a version comment (`uses: owner/action@<sha> # vX.Y.Z`);
5256
run `just zizmor` after editing workflows
@@ -56,6 +60,8 @@ Run `just lint` and `just test` before considering a change done.
5660
- uv is pinned to 0.13.x in four places that must stay in sync: `[tool.uv] required-version` and the
5761
`uv_build` requirement in `pyproject.toml`, `setup-uv` `version` in the workflows, and the uv image in
5862
`.devcontainer/Dockerfile`
63+
{%- if use_releases %}
5964
- Do not bump `[project] version` by hand; the Release workflow does it
6065
- Every PR needs a release label (GitHub PR label, not a title/commit prefix): `breaking`, `feature`,
6166
`enhancement`, `bug`, `fix`, `chore`, `ci`, `dependencies`, `documentation`, `refactor`, or `skip-changelog`
67+
{%- endif %}

‎template/README.md.jinja‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,39 @@ manage project configuration and commands
3434
* `just test` - run unit tests
3535
* `just audit` - check dependencies for known vulnerabilities with pip-audit
3636
* `just markdownlint` - lint Markdown files with markdownlint-cli2
37+
{%- if use_docs %}
3738
* `just docs-build` - build the docs site with Zensical (strict mode, output in `site/`)
3839
* `just docs-serve` - serve the docs locally with live reload
40+
{%- endif %}
3941
* `just prek` - run pre-commit hooks via prek
4042
* `just git-leaks` - scan staged changes for secrets with gitleaks
4143
* `just zizmor` - audit GitHub Actions workflows for security issues
44+
{%- if use_releases %}
4245
* `just set-github-labels` - remove GitHub's non-release default labels, then create or update the release labels
4346
(for fresh repos, requires `gh auth login`)
47+
{%- endif %}
4448
* `uv add {package}` - install a dependency
4549

4650
## CI and Security
4751

4852
| Workflow | Runs on | Purpose |
4953
| --------------------- | ----------------------- | -------------------------------------------- |
54+
{%- if use_docs %}
5055
| `python.yml` | push / PR to `main` | lint, unit tests, docs build, markdownlint |
56+
{%- else %}
57+
| `python.yml` | push / PR to `main` | lint, unit tests, markdownlint |
58+
{%- endif %}
5159
| `security.yml` | push to `main`, all PRs | zizmor, gitleaks, pip-audit dependency audit |
60+
{%- if use_releases %}
5261
| `release-drafter.yml` | push to `main`, PRs | update the draft release, label PRs |
5362
| `release.yml` | manual | publish a release |
63+
{%- endif %}
5464

5565
* GitHub Actions are pinned to full commit SHAs, with the version in a trailing comment
5666
* Dependabot (`.github/dependabot.yml`) checks monthly for updates to GitHub Actions, Python
5767
dependencies, the dev container image, and dev container features. New releases wait 7 days
5868
before an update is proposed. Dependabot PRs get the `dependencies` label
69+
{%- if use_releases %}
5970

6071
## Releases
6172

@@ -83,6 +94,7 @@ labels; any other repository labels you add are ignored.
8394
* Merging to `main` updates a draft GitHub Release with the next version and notes
8495
* To release, run the **Release** workflow from the Actions tab. It bumps the version in
8596
`pyproject.toml`/`uv.lock`, tags the release, and uploads build artifacts. Release notes live on the GitHub Release
97+
{%- endif %}
8698

8799
## Usage
88100

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ ci-lint:
1212
uv run ruff format --check .
1313
uv run codespell
1414
uv run actionlint .github/workflows/*.yml
15+
{%- if use_docs %}
1516
# Build the docs in strict mode (output in site/)
1617
docs-build:
1718
uv run zensical build --strict
1819
# Serve the docs locally with live reload
1920
docs-serve:
2021
uv run zensical serve
22+
{%- endif %}
2123
# Scan staged changes for secrets
2224
git-leaks:
2325
gitleaks git --pre-commit --staged --redact
@@ -34,9 +36,11 @@ markdownlint:
3436
# Run the git hooks on staged files
3537
prek:
3638
uv run prek
39+
{%- if use_releases %}
3740
# Remove non-release default labels and sync the release labels on GitHub
3841
set-github-labels:
3942
./scripts/sync-labels.sh
43+
{%- endif %}
4044
# Install Homebrew tools and sync the project
4145
setup:
4246
brew bundle install
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ hooks = [
3232
entry = "just test",
3333
pass_filenames = false
3434
},
35+
{%- if use_docs %}
3536
{
3637
id = "docs-build",
3738
name = "docs build",
@@ -40,6 +41,7 @@ hooks = [
4041
files = "^(docs/|src/|zensical\\.toml$)",
4142
pass_filenames = false
4243
},
44+
{%- endif %}
4345
{
4446
id = "markdownlint",
4547
name = "markdownlint",

‎template/pyproject.toml.jinja‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ dev = [
2121
"ruff>=0.17.3",
2222
"ty>=0.0.96",
2323
]
24+
{%- if use_docs %}
2425
docs = [
2526
"mkdocstrings[python]>=1.0.8",
2627
"zensical>=0.1.0",
2728
]
2829

2930
[tool.codespell]
3031
skip = "./site" # Built docs output
32+
{%- endif %}
3133

3234
[tool.pytest.ini_options]
3335
addopts = "--cov=src --cov-report=term-missing --cov-fail-under 98"

0 commit comments

Comments
 (0)