Skip to content

Commit 86053b0

Browse files
authored
chore(deps): pin Playwright + jsonschema as dev dependencies (#95 / #94 follow-up) (#100)
* chore(deps): requirements-dev.txt pinning Playwright + jsonschema (#95 / #94) Pins the two third-party Python packages that the repo's dev tooling imports, so a fresh clone is reproducible without ambient pip state: - playwright>=1.54,<2.0 — tools/capture-gallery-hero.py (#67 / #94 hero PNG) - jsonschema>=4.0,<5.0 — verify-plugin.sh, verify-security.sh, verify-seed-expectations.sh, mock-bootstrap.sh, generate-spec-anchor-audit.py Preview Forge is not a Python package, so no pyproject.toml — a plain requirements-dev.txt matches the script-driven nature of the Python side. The capture-gallery-hero.py docstring now references the new install contract. Verified: - python3 -m pip install -r requirements-dev.txt (fresh venv) — succeeds - bash scripts/verify-plugin.sh — Pass: 57 / Fail: 0 - bash tests/fixtures/security/verify-security.sh — all defenses holding - bash tests/e2e/mock-bootstrap.sh {standard,pro,max} — PASS x3 * docs(contributing): Python dev setup section (#95 / #94) Adds a "Python dev setup (optional, for tooling / verify-* scripts)" subsection under "Local setup", documenting the requirements-dev.txt contract added in the preceding commit (Playwright + jsonschema) and the optional `playwright install` step for hero-screenshot regen. Notes that Preview Forge is not a Python package (no pyproject.toml) and that verify-plugin.sh degrades gracefully on missing jsonschema locally but is fail-closed in CI.
1 parent 0a4d34d commit 86053b0

3 files changed

Lines changed: 69 additions & 0 deletions

File tree

CONTRIBUTING.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,36 @@ claude --plugin-dir ./plugins/preview-forge
6060

6161
Inside Claude Code, try `/pf:help` to see the 14 commands.
6262

63+
### Python dev setup (optional, for tooling / verify-\* scripts)
64+
65+
Preview Forge is primarily JavaScript / Markdown, but a handful of Python
66+
scripts and tools ship with the repo (hero screenshot helper, schema
67+
validators embedded in `verify-*` shell harnesses, hooks under
68+
`plugins/preview-forge/hooks/`). Two third-party packages are pinned in
69+
[`requirements-dev.txt`](./requirements-dev.txt):
70+
71+
- **`playwright`** — used by `tools/capture-gallery-hero.py` to regenerate
72+
`docs/assets/v1.6-gallery-hero.png` (#67 / #94).
73+
- **`jsonschema`** — used by `scripts/verify-plugin.sh`,
74+
`tests/fixtures/security/verify-security.sh`,
75+
`tests/fixtures/seed-expectations/verify-seed-expectations.sh`, and
76+
`tests/e2e/mock-bootstrap.sh` for schema validation.
77+
78+
Install (once, ideally in a venv):
79+
80+
```bash
81+
python3 -m venv .venv && source .venv/bin/activate # optional but recommended
82+
python3 -m pip install -r requirements-dev.txt
83+
84+
# Only if you need to regenerate the hero screenshot:
85+
python3 -m playwright install --with-deps firefox chromium
86+
```
87+
88+
The repo is **not** a Python package — there is no `pyproject.toml` /
89+
`setup.py`. `requirements-dev.txt` documents the contract; nothing is
90+
installed by `bash scripts/verify-plugin.sh` itself (it degrades gracefully
91+
when `jsonschema` is missing, except in CI where it is fail-closed).
92+
6393
## Contribution types
6494

6595
### 1. 📚 LESSON (most welcome)

requirements-dev.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Dev-only Python dependencies for Preview Forge tooling.
2+
#
3+
# Install:
4+
# python3 -m pip install -r requirements-dev.txt
5+
#
6+
# Browser binaries for Playwright (one-off, after the pip install above):
7+
# python3 -m playwright install --with-deps firefox chromium
8+
#
9+
# Preview Forge is NOT a Python package (no installable source / __init__.py).
10+
# These pins exist so the handful of Python *scripts* and *tools* that the
11+
# repo ships are reproducible without ambient pip state. JS-side tooling
12+
# stays in package.json / pnpm-workspace.yaml.
13+
14+
# ---------------------------------------------------------------------------
15+
# Hero screenshot helper
16+
# tools/capture-gallery-hero.py — regenerates docs/assets/v1.6-gallery-hero.png
17+
# (the README/SUBMISSION above-the-fold gallery hero, #67 / #94).
18+
# ---------------------------------------------------------------------------
19+
playwright>=1.54,<2.0
20+
21+
# ---------------------------------------------------------------------------
22+
# JSON Schema validation (used by several verify-* shell harnesses that
23+
# embed `python3 -c "import jsonschema; ..."`):
24+
# - scripts/verify-plugin.sh (profiles schema check)
25+
# - tests/fixtures/security/verify-security.sh (I-7 / S-3 defenses)
26+
# - tests/fixtures/seed-expectations/verify-seed-expectations.sh
27+
# - tests/e2e/mock-bootstrap.sh (previews schema, fail-closed in CI)
28+
# - scripts/generate-spec-anchor-audit.py (optional; degrades gracefully)
29+
# ---------------------------------------------------------------------------
30+
jsonschema>=4.0,<5.0

tools/capture-gallery-hero.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@
1616
1717
Determinism: fonts loaded, animations disabled, viewport pinned, file://
1818
URI. Re-running on the same gallery.html produces a byte-stable PNG.
19+
20+
Setup (#95 / #94 follow-up — Playwright is now a pinned dev dependency):
21+
22+
python3 -m pip install -r requirements-dev.txt
23+
python3 -m playwright install --with-deps firefox chromium
24+
25+
See requirements-dev.txt and CONTRIBUTING.md ("Python dev setup") for the
26+
full contract. Previously this script relied on an ambient `playwright`
27+
install; the pin makes it reproducible on a fresh clone.
1928
"""
2029
from __future__ import annotations
2130

0 commit comments

Comments
 (0)