Skip to main content

Fast Python bindings for Project Haystack — types, codecs (Zinc/Trio/JSON), filters, ontology, and Xeto support powered by Rust

Project description

rusty-haystack

Fast Python bindings for Project Haystack powered by Rust.

Provides types, codecs (Zinc/Trio/JSON/JSON v3/CSV), filters, an in-memory entity graph, ontology validation, and Xeto support — all backed by a native Rust core for speed and correctness.

Installation

pip install rusty-haystack

Requires Python 3.11+. Pre-built wheels are available for Linux and macOS (x86_64 and aarch64).

Quick Start

import rusty_haystack as rh

# Create an entity
entity = rh.HDict({
    "id": rh.Ref("site-1", "Demo Site"),
    "site": rh.Marker(),
    "dis": "Demo Site",
    "area": rh.Number(5000, "ft²"),
    "geoCoord": rh.Coord(40.7128, -74.0060),
})

# Build a graph and query it
graph = rh.EntityGraph()
graph.add(entity)
results = graph.read("site")

# Encode/decode across formats
zinc_str = rh.encode_grid("text/zinc", results)
json_str = rh.encode_grid("application/json", results)
decoded = rh.decode_grid("text/zinc", zinc_str)

# Validate against the standard ontology
ns = rh.DefNamespace.load_standard()
issues = ns.validate_entity(entity)

Features

  • Kind types — Marker, NA, Remove, Number (with units), Ref, Uri, Symbol, XStr, Coord, HDateTime, HDict, HGrid, HList
  • Codecs — Zinc, Trio, JSON, JSON v3, CSV encoding and decoding
  • Filters — Parse and evaluate Haystack filter expressions against entities
  • EntityGraph — In-memory graph with CRUD, filter queries, and ref traversal
  • Ontology — DefNamespace with is_a, fits, validate_entity, subtype/supertype queries
  • Xeto — Load/unload Xeto libraries, inspect specs and slots, export to Xeto source

Codecs

Supported MIME types: "text/zinc", "text/trio", "application/json", "application/json;v=3", "text/csv".

# Grid encode/decode
zinc_str = rh.encode_grid("text/zinc", grid)
grid = rh.decode_grid("text/zinc", zinc_str)

# Scalar encode/decode
s = rh.encode_scalar("text/zinc", rh.Number(72.5, "°F"))
v = rh.decode_scalar("text/zinc", s)

EntityGraph

graph = rh.EntityGraph()
graph.add(rh.HDict({"id": rh.Ref("site-1"), "site": rh.Marker(), "dis": "HQ"}))
graph.add(rh.HDict({"id": rh.Ref("ahu-1"), "equip": rh.Marker(), "siteRef": rh.Ref("site-1")}))

results = graph.read("equip")       # filter query
graph.refs_from("ahu-1")            # -> ["site-1"]
graph.refs_to("site-1")             # -> ["ahu-1"]

Ontology & Xeto

ns = rh.DefNamespace.load_standard()

ns.is_a("ahu", "equip")            # True
ns.fits(entity, "site")            # True
ns.subtypes("equip")               # ["ahu", "vav", ...]
ns.validate_entity(entity)         # list of issue strings

# Load custom Xeto libraries
ns.load_xeto(source_text, "myLib")
spec = ns.get_spec("myLib::MyType")

License

MIT

Project details


Download files

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

Source Distribution

rusty_haystack-0.7.2.tar.gz (475.9 kB view details)

Uploaded Source

Built Distributions

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

rusty_haystack-0.7.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

rusty_haystack-0.7.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

rusty_haystack-0.7.2-cp313-cp313-macosx_11_0_arm64.whl (6.2 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rusty_haystack-0.7.2-cp313-cp313-macosx_10_12_x86_64.whl (6.6 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

rusty_haystack-0.7.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

rusty_haystack-0.7.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

rusty_haystack-0.7.2-cp312-cp312-macosx_11_0_arm64.whl (6.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rusty_haystack-0.7.2-cp312-cp312-macosx_10_12_x86_64.whl (6.6 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

rusty_haystack-0.7.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (7.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

rusty_haystack-0.7.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

rusty_haystack-0.7.2-cp311-cp311-macosx_11_0_arm64.whl (6.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rusty_haystack-0.7.2-cp311-cp311-macosx_10_12_x86_64.whl (6.6 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

Details for the file rusty_haystack-0.7.2.tar.gz.

File metadata

  • Download URL: rusty_haystack-0.7.2.tar.gz
  • Upload date:
  • Size: 475.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for rusty_haystack-0.7.2.tar.gz
Algorithm Hash digest
SHA256 ab6e7da9d3d5b1287e8462ecbdadc3b8794666f057e974bb5f9fa645ac887b0a
MD5 b18d18b15ef3768404e1e9aae672217a
BLAKE2b-256 e341c7f7a7818bca3fd184faf7fb05deb18c60e4e76f7241657a2e949a39d331

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.7.2.tar.gz:

Publisher: python.yml on jscott3201/rusty-haystack

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

File details

Details for the file rusty_haystack-0.7.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.7.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 65626ccf321af4f7231b9dbdf87fe6edbd7cec8317c866989bc30b07360e5b90
MD5 da68a7315b7131484d6d2c9ef5686838
BLAKE2b-256 e9c9ba609206c7e5c495229e7cd79c68f9493dd12b3fafb70e07cc5223e9e9ab

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.7.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python.yml on jscott3201/rusty-haystack

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

File details

Details for the file rusty_haystack-0.7.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.7.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 abb49945c2cdfd461c099406ff21557ba3948725f66c98ad34754b42b71d84ed
MD5 69b7c29c8992a70c37158d7a6c6fea22
BLAKE2b-256 fde672ab8af671f7914f1a10d40583a26bb774a9db7ed812c8428aa7edca02a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.7.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: python.yml on jscott3201/rusty-haystack

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

File details

Details for the file rusty_haystack-0.7.2-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.7.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e9926f93b53318d13f4f704124a8b5e8e22a0b74ac7c72710b821ebadc454c7a
MD5 52f75060c86a939d8f9e4c17fe52cb73
BLAKE2b-256 937f836110a1f21f5aa83a4bad8abd7ff11fa0b2182303e959eae3659d491748

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.7.2-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: python.yml on jscott3201/rusty-haystack

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

File details

Details for the file rusty_haystack-0.7.2-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.7.2-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ce40d44a55918e025a342e747e922178c4328bf25aefeaedfc70df7272efac75
MD5 16d490b3f1ff34414d1cc9a0c234f360
BLAKE2b-256 e2045c388b7a700448a2c6bfe7ac0c66feb64d028c24efd929532596dc55724b

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.7.2-cp313-cp313-macosx_10_12_x86_64.whl:

Publisher: python.yml on jscott3201/rusty-haystack

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

File details

Details for the file rusty_haystack-0.7.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.7.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1b041070d10ccea29785b90f40c9ee5c55488cdd17a04804778276c63ba84428
MD5 5712419e5219caaeb0ed674c8d4fc56e
BLAKE2b-256 25d77207ec82e9b79dfceb6ac7c10379ea4c3292c81fa2846fb3b54a1eba6dc2

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.7.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python.yml on jscott3201/rusty-haystack

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

File details

Details for the file rusty_haystack-0.7.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.7.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4decd391c6321e0912d942d3c49919c3066f06b8c72f9375e4f0c64c0c42ee04
MD5 3be0872c7f995ed2e7b05c81da53321b
BLAKE2b-256 b7214da1836e4b060d4b358b1922f4d92d7a41ad7f94486518c9aba156c6f3e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.7.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: python.yml on jscott3201/rusty-haystack

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

File details

Details for the file rusty_haystack-0.7.2-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.7.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c5d9959935e65a8b3fc3280d14e58382ca86a08a4b78b82b7431c9978098b6f7
MD5 ec6e9dc115acf5eca52613fced336b78
BLAKE2b-256 c2ddbedb28bc4567b0a86d4326a1ea6c294b92eff9cf8289d21b98edc4b5381c

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.7.2-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: python.yml on jscott3201/rusty-haystack

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

File details

Details for the file rusty_haystack-0.7.2-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.7.2-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 88c5a78a73f2f6d2d7559e601a63e6f64d95397d3ce8853fb78ba63a25b20430
MD5 c46a982801e29c3f96e50a3c3b77e2de
BLAKE2b-256 4cf44d7000760ee267be3402ed36c1aa2c3845a461af7ceff049d201a55c80a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.7.2-cp312-cp312-macosx_10_12_x86_64.whl:

Publisher: python.yml on jscott3201/rusty-haystack

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

File details

Details for the file rusty_haystack-0.7.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.7.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ea1dcbb64fed950ea327057a0e01ec31de9b465a02006ed843d99d0f492c7260
MD5 1bc1337651e55e6ba11b82e595d27212
BLAKE2b-256 f36b67f395666e69c2ba12ca45fb316d2d3f335650107b899f8becc7b50d8e0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.7.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: python.yml on jscott3201/rusty-haystack

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

File details

Details for the file rusty_haystack-0.7.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.7.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 6a5a12f721e47ca325729a0020a4487d7cb4d69cd1c38fb3232f2e865b566a1a
MD5 806326c4c4e5c90c3530a6ccf308033c
BLAKE2b-256 1a3c8305e88bba38bdd966b4925672c22d8f2191ff21fa20cc828332bece4508

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.7.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: python.yml on jscott3201/rusty-haystack

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

File details

Details for the file rusty_haystack-0.7.2-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.7.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4a6236b2d569499d85e6f36efeb499d36c0cc4f2b5118ed84893d6318f73f340
MD5 fb4e44e48d71f49a237c1c8a67f31acb
BLAKE2b-256 91c6c9baf611bdeb64b7e8effe78100f82f3325476e9e21dbc6252686ca7785a

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.7.2-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: python.yml on jscott3201/rusty-haystack

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

File details

Details for the file rusty_haystack-0.7.2-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.7.2-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8f9557160dc552bb48b67177286dafd8f8696eb1002f292e73123302399a18de
MD5 6bfccdeb42806801025738b198c716fb
BLAKE2b-256 b9654a0944646acc7766c520076e744b2933039f2afbed2f8580630721054d8a

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.7.2-cp311-cp311-macosx_10_12_x86_64.whl:

Publisher: python.yml on jscott3201/rusty-haystack

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

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