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.4.3.tar.gz (273.4 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.4.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (939.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

rusty_haystack-0.4.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (894.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

rusty_haystack-0.4.3-cp313-cp313-macosx_11_0_arm64.whl (834.6 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rusty_haystack-0.4.3-cp313-cp313-macosx_10_12_x86_64.whl (856.5 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

rusty_haystack-0.4.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (940.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

rusty_haystack-0.4.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (894.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

rusty_haystack-0.4.3-cp312-cp312-macosx_11_0_arm64.whl (834.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rusty_haystack-0.4.3-cp312-cp312-macosx_10_12_x86_64.whl (856.7 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

rusty_haystack-0.4.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (936.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

rusty_haystack-0.4.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (890.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

rusty_haystack-0.4.3-cp311-cp311-macosx_11_0_arm64.whl (840.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rusty_haystack-0.4.3-cp311-cp311-macosx_10_12_x86_64.whl (865.9 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: rusty_haystack-0.4.3.tar.gz
  • Upload date:
  • Size: 273.4 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.4.3.tar.gz
Algorithm Hash digest
SHA256 3a0b129f8003b46709df8a62f6add84a948d9fd573eacc091aee572c179ff3d7
MD5 d0c759c602db2f879afc340c3f9127ff
BLAKE2b-256 ceccd4777c7df2c364c1ca4e89335e71618a08968d2b3e624777dfa449a381ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.4.3.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.4.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.4.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 eafbdec192166cd3900ee6c130630801bbc845938c4df769e46d1829a3694b78
MD5 79961fb66dedbfcf93d2d6857edf881e
BLAKE2b-256 256dd1463789c76ca04851aa67cc6cdd975a771a83a5477951c862c715e6713e

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.4.3-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.4.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.4.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 41e576c11d44a9fb15fc1c3e884d749a813d34d03e5fdf40528c89eaafdb4449
MD5 57853a7b77630ea941f56298969c0ab0
BLAKE2b-256 025f0661e8391e92eaf08da0dd9262b0c9220d5dc4c1a5c54988de6402e83f67

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.4.3-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.4.3-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.4.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c9cde8d445f437f9ab67caa12c05b1e29c4c3d36016ae8dd4cddb6bd320f22dc
MD5 70f75394f085dc28129d9eda1447b421
BLAKE2b-256 2f18887b3a6e118edd3adf53fd1be8aded0fd831ffe98edd9b47c1d259b034a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.4.3-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.4.3-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.4.3-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 0275c84f0454b277ebad6e8eec777de86c68de86491b3b5089ca5187828f25ca
MD5 0d2037132445abcc1988edc450ab7567
BLAKE2b-256 c07382ffffba66030b6959ecc28591c54f0e93a900fdbe7175a9a40a4344709f

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.4.3-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.4.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.4.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 424cb4961e54422950dcdc1a82d747b07beea348e28c48af2462f0a6dcb940c3
MD5 67461240afe23aa4aaf5b1e9a65f498a
BLAKE2b-256 ea1bbffaae0c465f3678c91e66652ebe81f2b28fe44e1a1f16c5d319f9b92af3

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.4.3-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.4.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.4.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 8d5372dcb1ce45479f0ed56cb3aef1f30af553583339cabdc85a65c689e29805
MD5 d54655b5722b05cc6b8fc23f01347025
BLAKE2b-256 2baa2e18340bd0e8120a3468725ab9486f6553ef0217050c6716dd789d573386

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.4.3-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.4.3-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.4.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1f2baabc886a5df29b0e846973fd66c79705e35ef498614ef2d679fe11a462fb
MD5 051faacdf84e1d60676ed19f996b6537
BLAKE2b-256 a1a0ea1d687331ca5f74220bb817a7febecd43dbf7975c6400cd6f22af619aa8

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.4.3-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.4.3-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.4.3-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a6a3a04335c55e1792c67c5a34718ea9e69f7f48d3e11b38d604286bf7b54a83
MD5 88b486e8554cdc5784f0f63c575648fd
BLAKE2b-256 2edcf6bfcd066a3eae6e5c9c2b9362c6b07bfcce377e00a2fb5607ee479510da

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.4.3-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.4.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.4.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a5b4607e03df5c8ba07bc7eab0a6f0171bce148d238b83c0c081687b2ac23b0e
MD5 4fd2f942f9b897debd7da9c243bf699a
BLAKE2b-256 7f67d9ffcdc4e8a59db4fb017af0eeac83693c91e54c898ac341972ddb3742a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.4.3-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.4.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.4.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 5324820ed55066c3b0b05ae05c1fa3424de9bdb6c23e22758cb8cd9914f51e13
MD5 ed184e680fd344e35bd768e93d2f97aa
BLAKE2b-256 0383ae1ed1ec7568c39ced2b5423fc2a3c6191c42c41d860f19cb9e7d5f45d73

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.4.3-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.4.3-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.4.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 62e7797a8ddeedbfa4b4eec69da307f1a3e359fc73fa7789330ad42b16a63608
MD5 84f748d89339259f910cddd7d81a5f96
BLAKE2b-256 d22762c306f65a6c21086181b894623337fd2ca0fa5976418928eb141d9b1348

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.4.3-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.4.3-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for rusty_haystack-0.4.3-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ccf1801308e6484e632f6582a0992672abda0c9541f2971043612568d60058b1
MD5 4a7e4355b38ac11f0026783bcd1eca11
BLAKE2b-256 ced32b4624ce121f279d4cbe07352546d109a1d9c5e9f26c8e87aceb9ef0e416

See more details on using hashes here.

Provenance

The following attestation bundles were made for rusty_haystack-0.4.3-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