Skip to main content

kaiv — Python bindings

Python bindings for kaiv, an immutable structural type system for data at rest. The same Rust core the CLI and the playground wrap, surfaced pythonically: strings in, strings (or bytes) out, exceptions instead of error envelopes.

pip install kaiv

The pipeline

import kaiv

# Authored .kaiv -> canonical .daiv (compile + denormalize).
daiv = kaiv.build("host=api.example.com\n!int\nport=8080\n")

# Schema-aware build: defaults materialize, head types lift,
# authored units convert (exactly, or the build fails).
daiv = kaiv.build(
    "!float:km\n/trip::dist=42\n",
    schema=".!saiv acme/trip\n\n!float:m\n/trip::dist=\n",
)
assert "/trip::dist=42000" in daiv

# Validation: None on pass, kaiv.ValidationError on a verdict.
schema = ".!saiv demo/server\n.!types std/net\n\n&port\nport=\n"
kaiv.validate(kaiv.build("port=8080\n"), schema)

# Schema inference: a document to its authored .saiv.
saiv = kaiv.infer("host=x\nport=8080\n", "demo/server")

# The standard formatter.
canonical = kaiv.fmt("a  =  1\n")

The format hub

# Foreign text formats -> authored .kaiv.
k = kaiv.import_from("json", '{"host": "x", "port": 8080}')

# Canonical .daiv -> foreign formats. Text formats return str,
# binary formats (cbor, avro, asn1) return bytes.
j = kaiv.export_to("json", kaiv.build(k))
b = kaiv.export_to("cbor", kaiv.build(k))

# Foreign schemas -> authored .saiv (sound weakening):
# jsonschema | xsd | proto | avsc | graphql.
s = kaiv.import_schema("jsonschema", open("api.schema.json").read(),
                       "acme/api")

Individual pipeline stages

raiv = kaiv.compile(text)        # .kaiv -> .raiv (relational)
daiv = kaiv.denormalize(raiv)    # .raiv -> .daiv (canonical)
csaiv = kaiv.compile_schema(s)   # .saiv -> .csaiv (contract)
text = kaiv.unbuild(daiv)        # .daiv/.raiv -> authored .kaiv
                                 # (a view: resolved sugar --
                                 # comments, variables, refs --
                                 # does not come back)

Errors raise kaiv.KaivError; validation verdicts raise kaiv.ValidationError (a subclass). kaiv.version() reports the bindings/core version.

The format is specified at kaiv.io/kaiv/spec/latest; resolution here is offline (the std/* libraries are embedded — registry-resolving builds belong to the CLI and kaiv db-class tooling).

License

MIT or Apache-2.0, at your option.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kaiv-0.13.0.tar.gz (16.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

kaiv-0.13.0-cp39-abi3-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.9+Windows x86-64

kaiv-0.13.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

kaiv-0.13.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.4 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

kaiv-0.13.0-cp39-abi3-macosx_11_0_arm64.whl (1.4 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

kaiv-0.13.0-cp39-abi3-macosx_10_12_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file kaiv-0.13.0.tar.gz.

File metadata

  • Download URL: kaiv-0.13.0.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for kaiv-0.13.0.tar.gz
Algorithm Hash digest
SHA256 45ee1e0d7af59e11b87e5fb34fc70892e79d7d01f5561ff48324cba64f807a8c
MD5 b871fdb13aa29a084e6d676494bf42bf
BLAKE2b-256 9ebff24e95f7ffa68e056cbf0715d7c2c1fab5e5e75a3116d5bd4999bb1de9b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for kaiv-0.13.0.tar.gz:

Publisher: publish-pypi.yml on deyanovich/kaiv-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kaiv-0.13.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: kaiv-0.13.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for kaiv-0.13.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 8878d2f103f02f23cdf1114cbb4fdc6df07ad3b9057460b49786c3a5173518f1
MD5 94981c5d353229d1047f9de6fd0cba5d
BLAKE2b-256 3cb08887bf7e345890f1776ff8aea7f1cad93028e8b9c7be8a62ff5a39938fff

See more details on using hashes here.

Provenance

The following attestation bundles were made for kaiv-0.13.0-cp39-abi3-win_amd64.whl:

Publisher: publish-pypi.yml on deyanovich/kaiv-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kaiv-0.13.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kaiv-0.13.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 43b64b733e3773a84be9d6b47a790d302ffcfd6694d8760ed4514f3242333dce
MD5 e96d01837c195c036dfd5a581d15cb67
BLAKE2b-256 5b25a93c9928a0641e4d1b9a0b6567d2158473a0edc6502f29f93c199da9d2b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for kaiv-0.13.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-pypi.yml on deyanovich/kaiv-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kaiv-0.13.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for kaiv-0.13.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 27a68e4c79226e0b9531e44e0dbe9707e10cf40fe5cb41118456b67b06b2af90
MD5 dba6ec39387759a164760f37e68c3197
BLAKE2b-256 9543ceee5ce774460c78e1d9793a397d9fc0e67d5b09e4dff101d9553e893398

See more details on using hashes here.

Provenance

The following attestation bundles were made for kaiv-0.13.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish-pypi.yml on deyanovich/kaiv-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kaiv-0.13.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: kaiv-0.13.0-cp39-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.9+, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for kaiv-0.13.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ee95c3aa26e2c9818dbba0206067c5f1c30487441c37190e036f093dca66dcbf
MD5 36541054ee3010548e7397efac854933
BLAKE2b-256 d69dfaa0f0b9c02316941ae740a35805111d95ffea7cf7fcb226230bb07fae61

See more details on using hashes here.

Provenance

The following attestation bundles were made for kaiv-0.13.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: publish-pypi.yml on deyanovich/kaiv-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kaiv-0.13.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for kaiv-0.13.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 848d4c3051286472aa947955a16b5dee5097071f21fb93bd5d703b7d3ff0b362
MD5 a199ac717c5f1cb2cd1297dead0afbb9
BLAKE2b-256 223f9d65f97c7b2aaf2a6932497089857e8bc03060830bcff2fc3f6c29c66376

See more details on using hashes here.

Provenance

The following attestation bundles were made for kaiv-0.13.0-cp39-abi3-macosx_10_12_x86_64.whl:

Publisher: publish-pypi.yml on deyanovich/kaiv-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.13.0 This release

6 files

0.11.0

6 files

0.10.0

6 files

0.1.0

2 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