Skip to content

Commit 560591a

Browse files
author
leynos
committed
Format Markdown sources
Normalize Markdown sources and exclude imported Copier documentation from lint.
1 parent 9a7676b commit 560591a

15 files changed

Lines changed: 913 additions & 605 deletions

.markdownlint-cli2.jsonc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"config": {
3+
"MD004": { "style": "dash" },
4+
"MD010": { "code_blocks": false },
5+
"MD013": {
6+
"line_length": 80,
7+
"code_block_line_length": 120,
8+
"tables": false,
9+
"headings": false
10+
},
11+
"MD029": { "style": "ordered" }
12+
},
13+
"ignores": [
14+
"**/.venv/**",
15+
".node_modules/**",
16+
"**/node_modules/**",
17+
"**/target/**",
18+
".terraform/**",
19+
".uv-cache/**",
20+
".uv-tools/**",
21+
"docs/configuring-a-copier-template.md",
22+
"docs/creating-a-copier-template.md",
23+
"CRUSH.md"
24+
]
25+
}

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: help check-fmt lint spelling test typecheck
1+
.PHONY: help check-fmt fmt lint spelling test typecheck
22

33
MAKEFLAGS += --no-print-directory
44

@@ -19,6 +19,10 @@ test: ## Run template tests
1919
check-fmt: ## Verify template test formatting
2020
$(UV) ruff format --check tests/
2121

22+
fmt: ## Format parent tests and Markdown sources
23+
$(UV) ruff format tests/
24+
mdformat-all
25+
2226
lint: ## Run template test lint checks
2327
$(UV) ruff check tests/
2428
$(UV) --with interrogate interrogate --fail-under 100 tests/

README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
# Generic Copier Template
22

33
This repository provides a [Copier](https://copier.readthedocs.io/) template
4-
for a Python package.
5-
It offers two flavours:
4+
for a Python package. It offers two flavours:
65

76
1. **Python Only** – a pure Python implementation.
87
2. **Python with Rust** – includes a PyO3 extension.
@@ -12,10 +11,10 @@ Run `copier copy` and answer the prompts to generate a project.
1211
## Running Tests
1312

1413
The test suite relies on the `pytest-copier` plugin and renders generated
15-
projects that run Ruff, Pylint via a PyPy-backed runner, `ty`, pytest, and, when
16-
the Rust extension is enabled, Clippy, Whitaker, and nextest-aware Rust tests.
17-
Generated Python linting also runs Interrogate as a 100% docstring-coverage
18-
gate.
14+
projects that run Ruff, Pylint via a PyPy-backed runner, `ty`, pytest, and,
15+
when the Rust extension is enabled, Clippy, Whitaker, and nextest-aware Rust
16+
tests. Generated Python linting also runs Interrogate as a 100%
17+
docstring-coverage gate.
1918

2019
Run the parent template tests through the repository `Makefile`. Run
2120
`make help` to list the available parent Makefile targets. Parent gates include
@@ -29,8 +28,8 @@ make test
2928

3029
Run `make test WITH_ACT=1` to include the act-backed workflow integration tests
3130
when `act` and Docker are available. Parent repository CI runs this mode in a
32-
separate act-validation workflow so rendered in-template GitHub workflows do not
33-
hold up the normal template test workflow.
31+
separate act-validation workflow so rendered in-template GitHub workflows do
32+
not hold up the normal template test workflow.
3433

3534
Generated projects install and run their own tooling, including Ruff,
3635
Interrogate, Pylint via PyPy, `ty`, pytest, and, when Rust is enabled, Clippy,
@@ -43,8 +42,8 @@ dependencies into the current Python environment manually.
4342

4443
Figure: The generated `make all` quality gate runs build, formatting, linting,
4544
typechecking, and testing. Rust-specific lint and test branches run only when
46-
the Rust extension is enabled. The `audit` target checks Python dependencies
47-
via `pip-audit` and, when Rust is enabled, Rust dependencies via `cargo audit`.
45+
the Rust extension is enabled. The `audit` target checks Python dependencies via
46+
`pip-audit` and, when Rust is enabled, Rust dependencies via `cargo audit`.
4847

4948
```mermaid
5049
flowchart LR

docs/adr-001-template-quality-gates.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ execution stay aligned.
3131
## Consequences
3232

3333
The generated Makefile remains the primary developer interface, but individual
34-
lint tiers can be run directly when narrowing failures. Rust-only tooling is not
35-
rendered for Python-only projects. The repository tests assert key generated
36-
file contracts instead of adding a snapshot framework to this branch.
34+
lint tiers can be run directly when narrowing failures. Rust-only tooling is
35+
not rendered for Python-only projects. The repository tests assert key
36+
generated file contracts instead of adding a snapshot framework to this branch.

docs/adr-002-adopt-cuprum-for-template-scripts.md

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ commands within `sh.scoped(...)`, and inspect `CommandResult.exit_code`,
2626
catalogues in a project module, while standalone scripts and tests should keep
2727
local catalogues scoped to the programs they need.
2828

29-
The generated documentation should signpost
30-
`docs/scripting-standards.md` from contributor-facing instructions so script
31-
authors find the `cuprum`, `Cyclopts`, `pathlib`, and `cmd-mox` conventions
32-
before adding automation.
29+
The generated documentation should signpost `docs/scripting-standards.md` from
30+
contributor-facing instructions so script authors find the `cuprum`, `Cyclopts`,
31+
`pathlib`, and `cmd-mox` conventions before adding automation.
3332

3433
## Alternatives considered
3534

@@ -45,9 +44,9 @@ allowlist without enforcing scoped command construction across the script.
4544
`plumbum` also makes observability a convention layered around command calls.
4645
Common logging, tracing, and command auditing would need bespoke wrappers, and
4746
those wrappers would be easy to bypass when a script author reaches directly for
48-
`local[...]` or an imported command object. That is acceptable for small private
49-
scripts, but it is a poor template default because generated projects inherit
50-
the convention without the local context that produced it.
47+
`local[...]` or an imported command object. That is acceptable for small
48+
private scripts, but it is a poor template default because generated projects
49+
inherit the convention without the local context that produced it.
5150

5251
Finally, `plumbum` raises on non-zero exits by default. That can be convenient
5352
for short scripts, but it encourages exception-driven control flow for command
@@ -57,10 +56,10 @@ observable values that tests can assert directly with `cmd-mox`.
5756
### Use subprocess directly
5857

5958
The standard library `subprocess` module avoids a dependency, but it leaves
60-
command allowlisting, argument construction, result handling, observability, and
61-
test-double integration to each script. That would make the template guidance
62-
longer and less consistent while still failing to provide a central enforcement
63-
point for external program access.
59+
command allowlisting, argument construction, result handling, observability,
60+
and test-double integration to each script. That would make the template
61+
guidance longer and less consistent while still failing to provide a central
62+
enforcement point for external program access.
6463

6564
## Consequences
6665

@@ -71,9 +70,8 @@ place to attach logging or auditing, and keeps command results testable as data.
7170

7271
Scripts no longer rely on exception-driven handling of non-zero command exits;
7372
they must check `CommandResult.exit_code` directly. This is slightly more
74-
verbose than `plumbum` for trivial calls, but it makes success and failure paths
75-
clear in both production scripts and tests that mock external executables.
73+
verbose than `plumbum` for trivial calls, but it makes success and failure
74+
paths clear in both production scripts and tests that mock external executables.
7675

77-
The template documentation now includes migration guidance for legacy
78-
`plumbum` usage, but the preferred path for new and updated scripts is
79-
`cuprum`.
76+
The template documentation now includes migration guidance for legacy `plumbum`
77+
usage, but the preferred path for new and updated scripts is `cuprum`.

docs/adr-003-shared-oxford-spelling-base.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ deterministic, tracked `typos.toml`.
2222

2323
The refresh validates data before atomic replacement, keeps a valid cache when
2424
its authority is not newer, and supports explicit offline reuse. The generated
25-
Makefile pins `typos`, exposes `make spelling`, includes spelling in `make all`,
26-
and runs it through Continuous Integration (CI). The template repository uses
27-
the same mechanism for its own Markdown and rendered Markdown sources.
25+
Makefile pins `typos`, exposes `make spelling`, includes spelling in
26+
`make all`, and runs it through Continuous Integration (CI). The template
27+
repository uses the same mechanism for its own Markdown and rendered Markdown
28+
sources.
2829

2930
## Consequences
3031

docs/adr-004-adopt-skylos-for-dead-code-detection.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,13 @@ Allowlist entries follow these rules:
140140
`lint-python` in `template/Makefile.jinja`, and implement the guarded
141141
`skylos-allow` target.
142142
2. Extend the template contract tests to prove that rendered projects install
143-
Skylos, run it through `make lint`, reject missing `NAME` or `REASON` values,
144-
invoke `skylos whitelist "$(NAME)" --reason "$(REASON)"` once, persist the
145-
documented entry under `[tool.skylos.whitelist]`, and expose the new target
146-
through `make help`. Assert that the target does not scrape reports or
147-
generate a baseline.
148-
3. Update `template/AGENTS.md.jinja` with the dead-code and allowlist policy, and
149-
update `template/docs/developers-guide.md` with the contributor workflow.
143+
Skylos, run it through `make lint`, reject missing `NAME` or `REASON`
144+
values, invoke `skylos whitelist "$(NAME)" --reason "$(REASON)"` once,
145+
persist the documented entry under `[tool.skylos.whitelist]`, and expose the
146+
new target through `make help`. Assert that the target does not scrape
147+
reports or generate a baseline.
148+
3. Update `template/AGENTS.md.jinja` with the dead-code and allowlist policy,
149+
and update `template/docs/developers-guide.md` with the contributor workflow.
150150
4. Add or update the parent repository's `docs/users-guide.md` to explain the
151151
dead-code gate and the generated `make skylos-allow` interface to template
152152
users.
@@ -159,8 +159,8 @@ Allowlist entries follow these rules:
159159
- Dynamic Python code can still produce false positives or false negatives;
160160
contributors must verify findings before removing code.
161161
- A name-based allowlist can accidentally cover a later symbol with the same
162-
name. Narrow entry-point rules and routine review reduce, but do not eliminate,
163-
this risk.
162+
name. Narrow entry-point rules and routine review reduce, but do not
163+
eliminate, this risk.
164164
- Skylos has a broader and faster-moving feature surface than this template
165165
needs. The generated configuration and documentation must keep the adopted
166166
surface limited to local dead-code detection.

docs/adr-004-pin-ty-version.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ resolved the latest release.
1313

1414
`ty` is pre-1.0 and its diagnostics change between releases. When ty 0.0.56
1515
landed, estate repositories with unpinned installations broke without any code
16-
change: the falcon-correlate and polythene main branches were red for days.
17-
An unpinned typechecker makes gate outcomes depend on release timing rather
18-
than on the code under review.
16+
change: the falcon-correlate and polythene main branches were red for days. An
17+
unpinned typechecker makes gate outcomes depend on release timing rather than
18+
on the code under review.
1919

2020
## Decision
2121

0 commit comments

Comments
 (0)