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.1.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view details)

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

kinogaki-0.1.0-py3-none-macosx_11_0_universal2.whl (515.7 kB view details)

Uploaded Python 3macOS 11.0+ universal2 (ARM64, x86-64)

File details

Details for the file kinogaki-0.1.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kinogaki-0.1.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fbd4551062aa605f2abf341069f43f47bf673108d5cbf57912db217995360e87
MD5 7f49f5a92fa0265745ce2fa90cd8f4d4
BLAKE2b-256 db87af1fa14e305838f63a7fcc309c51a5fab9c18d86b8cc4309ff125fb5ddc2

See more details on using hashes here.

File details

Details for the file kinogaki-0.1.0-py3-none-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for kinogaki-0.1.0-py3-none-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 53a0de1f80114fee0285b6a375e8a734c05b66f2b85670a6b2f7ca303ff00f53
MD5 0f43622dce66311284109547adbf22bb
BLAKE2b-256 a9c0cc9bc0db8de17edb33e25de5b7e560e1e8ad5ae31dfae045bced9b8b07ab

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