This public package is the Python mirror of CapDAG. It provides Tagged, Media, and Cap URNs; capability definitions; registry resolution; Machine Notation; planning and execution; Bifaci; and the Python cartridge runtime and CLI.
Rust is the behavioral reference. Shared numbered tests carry the same meaning across mirrors, so current test catalogues—not a prose count—record parity.
Python 3.11 or newer is required.
python3 -m pip install capdagFor a source checkout:
python3 -m pip install -e '.[dev]'from capdag import CapUrn, CapUrnBuilder
parsed = CapUrn.from_string(
'cap:disbind;in="media:document;ext=pdf";out="media:enc=utf-8;page"'
)
built = (
CapUrnBuilder()
.in_spec("media:document;ext=pdf")
.out_spec("media:enc=utf-8;page")
.marker("disbind")
.build()
)
assert parsed.to_string() == built.to_string()Treat URNs as opaque parsed values. Use their predicates for equivalence, conformance, dispatch, and ranking rather than splitting or comparing their serialized strings.
The package follows the boundaries in the CapDAG specification:
capdag.urncontains Tagged, Media, and Cap URNs;capdag.capcontains definitions, argument sources, schema validation, and callers;capdag.machineandcapdag.plannercontain notation, planning, and execution structures;capdag.bifacicontains frames, streaming, flow control, cartridge and host runtimes, and relay components; and- registry modules resolve versioned fabric and cartridge data.
Docstrings beside public Python objects are the language-specific API reference. Language-neutral rules belong to the canonical specification.
capdag new sentiment-tagger --python
cd sentiment-tagger
capdag dev-install .
echo "I love this" | capdag sentiment-taggerThe generated project demonstrates a manifest, canonical URNs, handler registration, typed input and output, a model-backed peer call, and progress forwarding. See Build and Run a Cartridge.
python3 -m pytestRun python3 -m pytest --cov=capdag when you also need a coverage report.
Shared behavior changes require the applicable reference test with the same
substantive number and assertions.
MIT