Skip to main content

KDNA Python Core + Adapter

This package contains two layers:

  1. kdna.core — an independent Python implementation of the KDNA protocol containers. It parses the ZIP envelope (mimetype STORED first, CBOR payload.kdnab), validates kdna.json / payload / checksums against the protocol JSON Schemas, computes the LoadPlan decision tree, emits the Runtime Capsule with digest evidence, and packs authoring sources into deterministic byte-identical containers. It has no dependency on the JS toolchain.
  2. kdna.loader — the existing adapter that delegates inspect → LoadPlan → authorization → load → Runtime Capsule to @aikdna/kdna-cli for applications that prefer the official JS runtime.

Python Core

from kdna.core import validate_file, plan_load_file, load_file, pack

result = validate_file("./writing.kdna")   # five gates + overall_valid
plan = plan_load_file("./writing.kdna")    # state / can_load_now / required_action
capsule = load_file("./writing.kdna", "compact")  # Runtime Capsule
pack("./authoring-source", "./writing.kdna")      # deterministic output

The Core is interoperable with the JS Core: a JS-packed container validates and loads identically in Python, a Python-packed container validates and loads identically in JS, and both packers produce byte-identical output for the same source (same SHA-256).

Install for local development

cd python-sdk
python -m pip install -e ".[dev]"
python -m pytest

This directory is not currently published as an official PyPI distribution. Use the npm CLI/Core packages for the published pre-release runtime. The Python Core is a source-level integration preview until a separate signed release pipeline exists.

The adapter layer supports @aikdna/kdna-cli >=0.35.0,<0.36.0 and checks the CLI version before its first operation. Compatibility with a later pre-1.0 CLI minor release must be verified before this range is widened. The adapter also validates the declared inspect response boundary (format_version, asset_id, version, and payload) instead of relying on the removed kdna_version field.

Adapter use

from kdna import inspect_kdna, open_kdna

metadata = inspect_kdna("./writing.kdna")
capsule = open_kdna("./writing.kdna", mode="minimum")
assert capsule["type"] == "kdna.runtime-capsule"

Modes map to Core profiles:

  • minimum → compact
  • all → full
  • auto → compact

The adapter fails closed when LoadPlan says can_load_now: false. Applications that support licensed, account, organization, or remote assets must use the corresponding authorization flow rather than bypassing it.

Set KDNA_CLI only when development or testing needs a non-global CLI command.

Metadata

Release files for aikdna 0.6.0

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

Source distribution (sdist)

Source distribution for aikdna 0.6.0
File Size Uploaded Provenance
aikdna-0.6.0.tar.gz 33.1 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 66.4 kB

Release files / aikdna-0.6.0.tar.gz

Download URL aikdna-0.6.0.tar.gz
Size 33.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1f9fb5d2f591a394178b71af332854efaa046bc56a1edde55c7920ab87abd657
BLAKE2b-256 checksum
How to use checksums
5b4154be675d64d806c2a352e166f05c947eda09886b7c0700696497a05536d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / aikdna-0.6.0-py3-none-any.whl

Download URL aikdna-0.6.0-py3-none-any.whl
Size 33.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1608bc27f83b5ef9dc1decfc7d15da6be7b0eb897551908dc0388f1532c5325f
BLAKE2b-256 checksum
How to use checksums
d0ed041fe17db46610bad8bd5e707b3c371bd0a108f21725e45ad4becdda54e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for aikdna 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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