CapDAG for Python
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.
Install the package
Python 3.11 or newer is required.
python3 -m pip install capdag
For a source checkout:
python3 -m pip install -e '.[dev]'
Parse and build Cap URNs
from capdag import CapUrn, CapUrnBuilder
parsed = CapUrn.from_string(
'cap:disbind;in="media:ext=pdf";out="media:enc=utf-8;page"'
)
built = (
CapUrnBuilder()
.in_spec("media: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.
Find the relevant API
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.
Scaffold a Python cartridge
capdag new sentiment-tagger --python
cd sentiment-tagger
capdag dev-install .
echo "I love this" | capdag sentiment-tagger
The 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.
Verify changes
python3 -m pytest
Run 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.
License
MIT
Metadata
Release files for capdag 1.439.51
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| capdag-1.439.51.tar.gz | 851.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| capdag-1.439.51-cp311-cp311-macosx_15_0_arm64.whl | CPython 3.11 | CPython 3.11 | macOS 15.0+ ARM64 | Details |
Total release size: 1.6 MB
Release files / capdag-1.439.51.tar.gz
| Download URL | capdag-1.439.51.tar.gz |
|---|---|
| Size | 851.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ec278dba57596ffac4ea1f56b1c4b485f6413c56b0e40a27363f8d9a67f06e6b
|
|
BLAKE2b-256 checksum How to use checksums |
9b92e0edcba17b3ea2f2e08edc006f2a9475a835d852da6425592942b843b0d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / capdag-1.439.51-cp311-cp311-macosx_15_0_arm64.whl
| Download URL | capdag-1.439.51-cp311-cp311-macosx_15_0_arm64.whl |
|---|---|
| Size | 714.1 kB |
| Tags | CPython 3.11 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
5d05117730591c349408e06474f62ce0ab6b8d3e866b2be92c2c22277848deca
|
|
BLAKE2b-256 checksum How to use checksums |
d5bb332a9b9216fd65746b95fba7b2eb68ae45c89423eac12fc1fd87ef0a6b2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|