Python Metaprogramming Capstone¶
Guide Maps¶
graph LR
family["Python Programming"]
program["Python Metaprogramming"]
guide["Capstone docs"]
section["README"]
page["Python Metaprogramming Capstone"]
proof["Proof route"]
family --> program --> guide --> section --> page
page -.checks against.-> proof
flowchart LR
orient["Read the guide boundary"] --> inspect["Inspect the named files, targets, or artifacts"]
inspect --> run["Run the confirm, demo, selftest, or proof command"]
run --> compare["Compare output with the stated contract"]
compare --> review["Return to the course claim with evidence"]
This capstone is an executable plugin runtime for incident delivery adapters. It is small enough to audit line by line and large enough to exercise the core tools of the course in one place:
- descriptor-backed configuration fields
- decorator-based action instrumentation with preserved signatures
- metaclass-driven registration and generated constructors
- introspection-driven manifest export for tooling and debugging
Start here¶
Use the smallest honest route for the question you have:
- Want to inspect the public runtime shape without execution? Run
make manifestormake registry. - Want to inspect one concrete field or action contract? Run
make fieldormake action. - Want one full learner-facing review bundle? Run
make PROGRAM=python-programming/python-meta-programming capstone-walkthroughfrom the repository root, ormake tourlocally. - Want executable confirmation? Run
make verify-report,make proof, ormake confirm.
If you are new to this capstone, the best first route is:
- Read FIRST_SESSION_GUIDE.md.
- Run
make manifest. - Read GUIDE_INDEX.md.
- Read PLUGIN_RUNTIME_GUIDE.md.
- Read ARCHITECTURE.md.
- Read
src/incident_plugins/framework.py, thenfields.py, thenactions.py. - Read the matching tests.
Start with these defaults¶
- If you do not know where to begin, read FIRST_SESSION_GUIDE.md.
- If you know the question but not the guide, read GUIDE_INDEX.md.
- If you know the guide but not the command, read COMMAND_GUIDE.md.
- If you already have a claim and need evidence, read PROOF_GUIDE.md.
What it models¶
- a
PluginMetametaclass that registers concrete plugins by group and stable name Fielddescriptors that validate and coerce plugin configuration- an
@actiondecorator that records invocations while preserving signatures - concrete incident-delivery plugins such as console, webhook, and pager adapters
- a runtime manifest that exposes field schemas and action signatures without executing plugin methods
Run it¶
From this directory:
Or use the saved review routes:
make manifest
make registry
make plugin
make field
make action
make signatures
make demo
make trace
make inspect
make tour
make verify-report
make proof
From the repository root, use the published course-level routes:
make PROGRAM=python-programming/python-meta-programming capstone-walkthrough
make PROGRAM=python-programming/python-meta-programming capstone-tour
make PROGRAM=python-programming/python-meta-programming capstone-verify-report
make PROGRAM=python-programming/python-meta-programming capstone-confirm
Documentation set¶
All supporting capstone guides live under docs/. Start from the group that matches
your pressure instead of reading the full list in alphabetical order.
First-pass orientation¶
Public surface and command choice¶
- COMMAND_GUIDE.md
- TARGET_GUIDE.md
- MANIFEST_GUIDE.md
- REGISTRY_GUIDE.md
- PUBLIC_API_GUIDE.md
- PUBLIC_SURFACE_MAP.md
Mechanism and ownership guides¶
- ACTION_GUIDE.md
- CONSTRUCTOR_GUIDE.md
- DEFINITION_TIME_GUIDE.md
- FIELD_GUIDE.md
- MECHANISM_SELECTION_GUIDE.md
- PACKAGE_GUIDE.md
- SCENARIO_GUIDE.md
- SCENARIO_SELECTION_GUIDE.md
- SOURCE_GUIDE.md
- SOURCE_TO_PROOF_MAP.md
Review, proof, and saved bundles¶
- BUNDLE_GUIDE.md
- BUNDLE_MANIFEST_GUIDE.md
- INSPECTION_GUIDE.md
- PROOF_GUIDE.md
- REVIEW_ROUTE_MAP.md
- TEST_GUIDE.md
- TEST_READING_MAP.md
- TOUR.md
- TRACE_GUIDE.md
- WALKTHROUGH_GUIDE.md
Concrete runtime examples¶
Read it by question¶
"What can I inspect without running business behavior?"¶
make manifestmake registry- COMMAND_GUIDE.md
- PUBLIC_SURFACE_MAP.md
- MANIFEST_GUIDE.md
- REGISTRY_GUIDE.md
- TARGET_GUIDE.md
"Where do wrappers, fields, and class creation live?"¶
- ARCHITECTURE.md
- DESIGN_BOUNDARIES.md
- PACKAGE_GUIDE.md
- SOURCE_GUIDE.md
- SOURCE_TO_PROOF_MAP.md
src/incident_plugins/actions.pysrc/incident_plugins/fields.pysrc/incident_plugins/framework.py
"What does one concrete plugin look like?"¶
make pluginmake fieldmake actionmake signatures- PLUGIN_CATALOG.md
- CONSTRUCTOR_GUIDE.md
"How do I review the full learner-facing route?"¶
- FIRST_SESSION_GUIDE.md
make PROGRAM=python-programming/python-meta-programming capstone-walkthroughmake inspectmake tour- INSPECTION_GUIDE.md
- REVIEW_ROUTE_MAP.md
- WALKTHROUGH_GUIDE.md
- TOUR.md
"How do I prove the runtime still works?"¶
make verify-reportmake proofmake confirm- TEST_GUIDE.md
- TEST_READING_MAP.md
- PROOF_GUIDE.md
Use these question routes when you already know the pressure. Otherwise, stay with the defaults above and escalate only one guide at a time.
Read it by course stage¶
- Observation modules: start with
make manifest,MANIFEST_GUIDE.md,make registry, andPROOF_GUIDE.md - Decorator modules: inspect
src/incident_plugins/actions.pyand the runtime tests - Descriptor modules: inspect
src/incident_plugins/fields.py,CONSTRUCTOR_GUIDE.md, andtests/test_fields.py - Metaclass module: inspect
src/incident_plugins/framework.pyandtests/test_registry.py - Governance and mastery: return to
make inspect,make verify-report, and the savedartifacts/bundles
Why this capstone exists¶
The course book explains individual mechanisms in isolation. This capstone makes the integration pressure visible. Class creation, descriptors, wrappers, and inspection all interact here, so the implementation has to stay honest about:
- which work happens at class-definition time
- what gets validated on assignment versus on invocation
- how signatures survive wrappers
- how registries stay deterministic and resettable in tests
Repository layout¶
src/incident_plugins/contains the framework and built-in plugins.src/incident_plugins/framework.pyowns registration, generated constructors, and manifest export.src/incident_plugins/fields.pyowns descriptor-backed field contracts.src/incident_plugins/actions.pyowns wrapper-backed action contracts.src/incident_plugins/plugins.pyowns concrete delivery adapters.tests/contains executable verification for descriptors, registration, and runtime manifests.ARCHITECTURE.md,TOUR.md,PROOF_GUIDE.md, and the local guide set turn the capstone into a learner-facing review surface.
Review routes¶
make manifestandmake registryinspect the public runtime shape without invoking plugin behavior.make plugin,make field,make action, andmake signaturesisolate one concrete public contract at a time.make demoandmake traceinspect one realistic runtime behavior and its recorded history.make inspectwrites the learner-facing inspection bundle with manifest and registry evidence.make tourwrites the learner-facing walkthrough bundle with manifest, registry, demo, and trace outputs.make verify-reportwrites the executable verification report bundle with pytest output and public-surface evidence.make confirmruns the strongest local executable confirmation route.make proofbuilds the published learner-facing review route.
Read PLUGIN_RUNTIME_GUIDE.md first when the runtime terms still feel fuzzier than the commands.
Best companion guides¶
- FIRST_SESSION_GUIDE.md for the smallest honest first pass
- GUIDE_INDEX.md for the smallest local route into the doc set
- COMMAND_GUIDE.md for local command selection and artifact locations
- PUBLIC_SURFACE_MAP.md for connecting commands, outputs, and owning files
- SOURCE_TO_PROOF_MAP.md for change-to-proof alignment
- TEST_READING_MAP.md for finding the first proof file by question
- REVIEW_ROUTE_MAP.md for choosing the right local route, command, and bundle
- ARCHITECTURE.md for ownership boundaries
- DESIGN_BOUNDARIES.md for what each mechanism owns and what it should not own
- PLUGIN_RUNTIME_GUIDE.md for the timing model
- MECHANISM_SELECTION_GUIDE.md for change placement
- SCENARIO_SELECTION_GUIDE.md for smallest-route selection
- EXTENSION_GUIDE.md for safe evolution
Definition of done¶
make inspectwrites the learner-facing inspection bundle with manifest and registry evidence.make tourwrites the guided walkthrough bundle for file-by-file review.make verify-reportcaptures pytest output together with the public runtime surface.make confirmcompletes the strongest local executable confirmation route.make proofcompletes the published learner review route end to end.