Skip to main content

Python bindings for Prism — a structured file format your tools and agents can edit.

Project description

kinogaki — Python bindings for Prism

kinogaki is the Python binding for Prism, a structured file format your tools and agents can edit. It is a thin, native layer over KinogakiCore (the C++ library) through its C ABI — the model mirrors the C++ API one-to-one.

import kinogaki as kg

doc = kg.Document()
doc.append("/world", "group")
doc.append("/world/red", "material").set("out", (0.9, 0.15, 0.15))
doc.append("/world/ball", "object") \
   .set("radius", 1.5) \
   .set("albedo", (1, 1, 1))
doc.connect("/world/red.out", "/world/ball.albedo")   # source output drives target input

text = kg.serialize(doc)                 # the .prisma (ASCII) bytes
again = kg.deserialize(text)             # parse text or binary back
print(kg.evaluate(again, "/world/ball.albedo"))   # (0.9, 0.15, 0.15) — through the connection

The API at a glance

  • kg.Document() — an ordered tree of typed prims plus the connections between their slots.
  • doc.append(path, type) -> Handle — add a prim (its parent must exist); returns a chainable cursor.
  • Handle.set(key, value) — author a typed property. The Prism type is inferred from the native value: bool/int/float/str, or a 2/3/6/32-length number sequence → float2/float3/matrix/spectrum.
  • Handle.set_meta(key, value) — string metadata (non-animatable, separate from properties).
  • doc.edit(path) -> Handle — a cursor for reading: get_float, get_int, get_bool, get_float2/3, get_str, get_meta (permissive, with defaults) and require_float, require_float3, require_str (strict — raise PrismError).
  • doc.connect(source, target) — wire an output slot to an input slot (one source per target).
  • doc.remove(path) · doc.rename(from, to) · doc.has(path) · doc.prim(path) · doc.prims().
  • kg.serialize(doc, binary=False) · kg.deserialize(data) · kg.evaluate(doc, slot, time=0).

Values are native both ways — no wrapper objects.

Installing

The package ships a universal (arm64 + x86_64) native library, so there is nothing to compile:

pip install kinogaki

Building from source

Clone kinogaki/kinogaki-core as a sibling of this repo, then:

./build.sh                 # compiles KinogakiCore → kinogaki/_native/libkinogaki_core.dylib
python -m pip install -e . # editable install
python tests/test_kinogaki.py

KINOGAKI_CORE_LIB overrides which native library is loaded, if you keep it elsewhere.

License

The Prism file format is open and free to implement. The code in this repository is licensed under the Apache License 2.0; see LICENSE. "Kinogaki" is a trademark of Kinogaki LLC; see TRADEMARKS.md. Contributions are accepted under the Developer Certificate of Origin; see CONTRIBUTING.md.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

kinogaki-0.2.0-py3-none-win_amd64.whl (2.1 MB view details)

Uploaded Python 3Windows x86-64

kinogaki-0.2.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (4.0 MB view details)

Uploaded Python 3manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

kinogaki-0.2.0-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (3.8 MB view details)

Uploaded Python 3manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

kinogaki-0.2.0-cp310-abi3-macosx_14_0_arm64.whl (4.1 MB view details)

Uploaded CPython 3.10+macOS 14.0+ ARM64

File details

Details for the file kinogaki-0.2.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: kinogaki-0.2.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kinogaki-0.2.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 c2ccaf073831fa4c7e23c8ed94cc3c9cf4d4ebaa306aaa50408967dd08157fb3
MD5 67771078581a3b46d75962aa3e26a7e6
BLAKE2b-256 cf5f09fdf337199330cd37ee2a1101ad2990fe4c4332b6a17f9f9e75d46b65d5

See more details on using hashes here.

File details

Details for the file kinogaki-0.2.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kinogaki-0.2.0-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f4b7d74190aa29fae868549a9b656511b891ab0c44f5b55b496a3e5134d1cc80
MD5 385a5ea90730200111d3f2f52e43c926
BLAKE2b-256 2e35e1894739c11090a34cca39e47ddf60fd77b7854a34815e2e23823e58338b

See more details on using hashes here.

File details

Details for the file kinogaki-0.2.0-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for kinogaki-0.2.0-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8eda2be533cf1f068b46ca4120ecf91fe3f956e86ec6a996cc25755a19e7ec38
MD5 e22cc6978692b2125919d3d216cffaa6
BLAKE2b-256 ca1adad4854967cde2c74457bf333dc04122c620ffc997be0a3f4136e7b842dd

See more details on using hashes here.

File details

Details for the file kinogaki-0.2.0-cp310-abi3-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for kinogaki-0.2.0-cp310-abi3-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 f3d01d4550c928eaea5b2ffeb070c2ac3d8323c5b8d9af57113405a719fc9c62
MD5 fd957d24f8d0df4847d160a6866566c0
BLAKE2b-256 18cb7c965dfb7b82430b788d943e90efaa4d87e584250671d3bfe7bcbb5af383

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page