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.11.0.tar.gz (18.8 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.11.0-cp39-abi3-win_amd64.whl (2.4 MB view details)

Uploaded CPython 3.9+Windows x86-64

kaiv-0.11.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.5 MB view details)

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

kaiv-0.11.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (2.4 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

kaiv-0.11.0-cp39-abi3-macosx_11_0_arm64.whl (2.3 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

kaiv-0.11.0-cp39-abi3-macosx_10_12_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for kaiv-0.11.0.tar.gz
Algorithm Hash digest
SHA256 335a3712b5c4b325a53d720582ca3cbe051b75b01a12b6da4b827d7c1944d3e3
MD5 a0cdce186615144abcbaa3d716e04b18
BLAKE2b-256 0ad6e5f873bbea192f5f083e0f028af85e3ab398b9ca06c581e9644009f239e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for kaiv-0.11.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.11.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: kaiv-0.11.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 2.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.11.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 9bf827786c984be2fedec48f36ef51c51a0d6140f7251dbf7920ff941277f000
MD5 c40a5d266d2a7f91b466cc0eabb7fd79
BLAKE2b-256 4478d6a1e6ccefe77de4ce77f22bfd71859706e305b3ab84973ebeedcba70635

See more details on using hashes here.

Provenance

The following attestation bundles were made for kaiv-0.11.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.11.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kaiv-0.11.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8de16c1d7d76790e5f1a4880312d7221f6afeb5e8dbc8350ebd35538381f1a16
MD5 b54d4649a8352bf17462488f83585647
BLAKE2b-256 e09dd41262058f5ebbcc47715d67473a80f435e3b75d2b0fad4d2a30c3467e04

See more details on using hashes here.

Provenance

The following attestation bundles were made for kaiv-0.11.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.11.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for kaiv-0.11.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 fb45f5d225b21b2ecf1ab80513ba518f2c66594825ecfcd506e7d639c49227a8
MD5 29db41b6ca355d0bc18e829f8781d0db
BLAKE2b-256 dcf5f455a7955dffaff2e1167ac6fdf570d214b0edc1f027af4a318eca7627d3

See more details on using hashes here.

Provenance

The following attestation bundles were made for kaiv-0.11.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.11.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

  • Download URL: kaiv-0.11.0-cp39-abi3-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 2.3 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.11.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 67db3ba5408914891c9964cec6bb37c5488280ea37999bbd6713df881571bcee
MD5 2db2b3d51db3f7ec08eeb93520569ee6
BLAKE2b-256 bc764848647334071bef6d1a3196fde89c9ecba8e0d9f3bf639c027911f77ca3

See more details on using hashes here.

Provenance

The following attestation bundles were made for kaiv-0.11.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.11.0-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for kaiv-0.11.0-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 40df1ccc826dc66d9ccc78c4f9b8780ee12ab2ff53a4d01223321c71630a9c13
MD5 729c7af3fa8fe55f2429ce523f1c46cc
BLAKE2b-256 a8d82cb56021c99c8079bcc05ac32881181e06990804f9bf260107b9b570d2eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for kaiv-0.11.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

0.13.0

6 files

This release

0.11.0 This release

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