You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+36-15Lines changed: 36 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
Python By Example is a Go By Example-inspired learning site for Python 3.13. It presents small literate examples with prose, source fragments, expected output, official Python documentation links, and an editable runner.
Copy file name to clipboardExpand all lines: docs/example-source-format-spec.md
+35-2Lines changed: 35 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -455,13 +455,14 @@ Build requirements:
455
455
456
456
## Formatter
457
457
458
-
`format_examples.py` should make Markdown examples stable without rewriting author voice.
458
+
`format_examples.py` makes Markdown examples stable without rewriting author voice.
459
459
460
460
Requiredbehavior:
461
461
462
462
- Preserve prose text, except for trimming trailing whitespace and normalizing blank lines.
463
+
- Parse TOML frontmatter and reserialize it deterministically.
463
464
-Sortfrontmatterkeysinthisorder: `slug`, `title`, `section`, `summary`, `doc_path`, then optional version fields.
464
-
- Normalize frontmatter to TOML with quoted strings.
465
+
- Normalize frontmatter to TOML with quoted strings and lowercase booleans.
465
466
- Normalize code fences to exactly `````python` and `````output`.
466
467
- Ensure each file ends with one newline.
467
468
- Leave Python code semantics unchanged; do not run Black over snippets unless the command can prove output is unchanged.
@@ -530,6 +531,36 @@ The command should fail if:
530
531
531
532
`verify-python-version` is only meaningful when `uv` can run the requested Python version. Until Cloudflare exposes the same runtime locally, the migration also requires a Worker smoke test for representative examples and at least one POST execution through Dynamic Workers.
532
533
534
+
## Golden fixture policy
535
+
536
+
`tests/fixtures/golden_examples.py` is temporary but intentional migration safety infrastructure.
537
+
538
+
Rules:
539
+
540
+
- Keep the golden fixture checked in while Markdown remains new.
541
+
- Do not update the golden fixture in the same change as ordinary content edits.
542
+
- If changing intended teaching structure, update Markdown first and let parity fail; then update the golden fixture in a separate explicit fixture-refresh commit after review.
543
+
- Remove the golden fixture only after at least one stable production release cycle, CI coverage for `make verify` and `make check-generated`, and an explicit cleanup PR.
544
+
- Until cleanup, `scripts/check_example_migration_parity.py` must be a required verification command.
545
+
546
+
## CI policy
547
+
548
+
GitHub Actions must run the same checks expected locally:
549
+
550
+
```bash
551
+
make verify
552
+
scripts/check_example_migration_parity.py
553
+
scripts/format_examples.py --check
554
+
make verify-python-version VERSION=3.13
555
+
git diff --check
556
+
```
557
+
558
+
CI must start `pywrangler dev --port 9696` before `make verify` so `browser-layout-test` exercises a real Worker runtime. CI must fail if generated files are stale.
559
+
560
+
## Contributor documentation policy
561
+
562
+
The README must describe Markdown example editing, `:::program`, `:::cell`, generated embedded source data, `make build`, `make verify-examples`, and the parity check. Contributors should not need to edit `src/examples.py` or `src/example_sources_data.py` by hand.
563
+
533
564
## Worker bundling policy
534
565
535
566
Default policy:
@@ -549,6 +580,8 @@ Do not replace this with a native Wrangler data-file approach unless a spike pro
549
580
550
581
The attempted migration failed at Worker startup because Markdown files were not present under `/session/metadata/`. That failure mode must remain covered by a local Worker startup check.
551
582
583
+
Native Markdown bundling remains unproven and is not on the production path. The accepted solution is embedded source data generated by `scripts/embed_example_sources.py`. A future native bundling change must be isolated as a spike and prove local dev, production deploy, imports, cache fingerprinting, and failure behavior before replacing embedded data.
584
+
552
585
## Golden parity script
553
586
554
587
Add a dedicated migration script before switching the app:
0 commit comments