Skip to content

Commit 1803e33

Browse files
authored
feat: fail CI if pyproject.toml still has placeholder strings (#59)
* feat: fail CI if pyproject.toml still has placeholder strings Adds a `placeholders` tox env that greps `pyproject.toml` for the template's placeholder strings (`placeholder-my-plugin`, `Your Name placeholder`, `placeholder@placeholder.com`) and fails if any are present. The check is wired into `test.yml` as a step gated by `github.repository != 'mloda-ai/mloda-plugin-template'` (and pinned to the 3.10 matrix leg so it runs once per workflow). This keeps the template repo's own CI green while scaffolded plugins fail until they update `pyproject.toml`. README "Setup Your Plugin" documents how to run the check locally and the template-repo exemption. `docs/github-repository-settings.md` notes that the check rides on the 3.10 matrix leg. Closes #47 * feat: broaden placeholder check to cover all five pyproject fields The check now flags the description and the setuptools/pytest placeholder entries in addition to name and authors, so it matches every field the README setup walks the user through. Patterns use POSIX character classes ([.], [*]) instead of backslash escapes for portability across GNU and BSD grep.
1 parent b146514 commit 1803e33

4 files changed

Lines changed: 27 additions & 1 deletion

File tree

.github/workflows/test.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,11 @@ jobs:
3131
- name: Run tox
3232
run: tox
3333
timeout-minutes: 2
34+
35+
# Skip on the template repo itself: the placeholders are intentional there.
36+
# Scaffolded plugins inherit no exemption and must update pyproject.toml
37+
# before this check passes. Runs once per workflow (only on the 3.10 leg).
38+
- name: Check pyproject.toml for template placeholders
39+
if: matrix.python-version == '3.10' && github.repository != 'mloda-ai/mloda-plugin-template'
40+
run: tox -e placeholders
41+
timeout-minutes: 1

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ The package name must be a valid Python identifier (lowercase letters, digits, u
7070
uv venv && source .venv/bin/activate && uv sync --all-extras && tox
7171
```
7272

73+
After `tox` passes, confirm `pyproject.toml` no longer contains the template's placeholder strings:
74+
75+
```bash
76+
tox -e placeholders
77+
```
78+
79+
This is also enforced in CI: the `test.yml` workflow fails on scaffolded plugins until the template's placeholder strings are removed from `pyproject.toml`. The check covers every field listed in step 2 above: `name`, `authors` (name and email), `description`, `tool.setuptools.packages.find.include`, and `tool.pytest.ini_options.testpaths`. It is skipped on the `mloda-ai/mloda-plugin-template` repository itself, where the placeholders are intentional.
80+
7381
#### 3. Remove template-only files
7482

7583
After `tox` passes, remove the files that only exist to support the template itself:

docs/github-repository-settings.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ The test workflow (`test.yml`) declares a job called `test` with a matrix over P
4949
- `test (3.12)`
5050
- `test (3.13)`
5151

52-
If you drop a Python version from the matrix in `test.yml`, also drop it from the required checks; otherwise PRs will block forever waiting for a check that never runs.
52+
If you drop a Python version from the matrix in `test.yml`, also drop it from the required checks; otherwise PRs will block forever waiting for a check that never runs. The placeholder check rides on the `3.10` leg via an `if:` guard in `test.yml`; if you change which Python version runs that step, update the guard to match.
5353

5454
The security scan (`security-scan.yaml`) and template sync (`template-sync.yaml`) workflows run on a schedule and do not produce per-PR checks, so they should not be added as required.
5555

tox.ini

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ commands =
1212
mypy --strict --ignore-missing-imports .
1313
bandit -c pyproject.toml -r -q .
1414

15+
[testenv:placeholders]
16+
# Fail if pyproject.toml still has the template's placeholder strings.
17+
# Covers every field the README setup walks through: name, authors,
18+
# description, tool.setuptools.packages.find.include, tool.pytest.ini_options.testpaths.
19+
# Run in CI for scaffolded plugins; skipped on the template repo itself.
20+
skip_install = true
21+
allowlist_externals = sh
22+
commands =
23+
sh -c 'if grep -nE "placeholder-my-plugin|Your Name placeholder|placeholder@placeholder[.]com|TEMPLATE PLACEHOLDER|\"placeholder[*]\"|\"placeholder\"" pyproject.toml; then echo; echo "ERROR: pyproject.toml still contains template placeholder strings."; echo "Update name, authors, description, tool.setuptools.packages.find.include, and tool.pytest.ini_options.testpaths before publishing."; exit 1; fi'
24+
1525
[testenv:security]
1626
# CVE scanning environment - builds and scans the local package
1727
usedevelop = true

0 commit comments

Comments
 (0)