Skip to main content

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.urn contains Tagged, Media, and Cap URNs;
  • capdag.cap contains definitions, argument sources, schema validation, and callers;
  • capdag.machine and capdag.planner contain notation, planning, and execution structures;
  • capdag.bifaci contains 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.353.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for capdag 1.353.13
File Size Uploaded
capdag-1.353.13.tar.gz 599.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for capdag 1.353.13
File Interpreter ABI Platform
capdag-1.353.13-py3-none-any.whl Python 3 none any Details

Total release size: 984.6 kB

Release files / capdag-1.353.13.tar.gz

Download URL capdag-1.353.13.tar.gz
Size 599.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c8623ccf02aa1125f94156e1ade4b8a3863c94d6d5f1d4b2b0f1b356e3e70d58
BLAKE2b-256 checksum
How to use checksums
e3e52a8da33df719cee5e4f0c3b5e531de4659fde2cb54467cab3cca4d83b8f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / capdag-1.353.13-py3-none-any.whl

Download URL capdag-1.353.13-py3-none-any.whl
Size 385.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c39aea9625521379d91af5dbc089a713aa769492d7f65985c95b8dd088d38922
BLAKE2b-256 checksum
How to use checksums
81fc658b04811ee25514a008e2ca762dbe5d774331f30b81e444307297ea319a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

1.353.13 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page