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.5.4.tar.gz (410.0 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.5.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

rusty_haystack-0.5.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

rusty_haystack-0.5.4-cp313-cp313-macosx_11_0_arm64.whl (5.9 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rusty_haystack-0.5.4-cp313-cp313-macosx_10_12_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

rusty_haystack-0.5.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

rusty_haystack-0.5.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

rusty_haystack-0.5.4-cp312-cp312-macosx_11_0_arm64.whl (5.9 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rusty_haystack-0.5.4-cp312-cp312-macosx_10_12_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

rusty_haystack-0.5.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (6.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

rusty_haystack-0.5.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (6.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

rusty_haystack-0.5.4-cp311-cp311-macosx_11_0_arm64.whl (6.0 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rusty_haystack-0.5.4-cp311-cp311-macosx_10_12_x86_64.whl (6.2 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: rusty_haystack-0.5.4.tar.gz
  • Upload date:
  • Size: 410.0 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.5.4.tar.gz
Algorithm Hash digest
SHA256 e64d8b030897dacd915e6f0449ab5d7b3d71bbfa6908e0ea5e93aa9cf4cd115a
MD5 09cda7d485019448f2545c9f770633b2
BLAKE2b-256 3efc37411481bae80ba2c4fbcef63926540328ab490c4d1872ac9c659781da44

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 aadac049c5ee1c9e37137240ad0d704cb684fbbbd0b127bf52179205ddad5ae6
MD5 cd57183bc91f34e4318b9e1e34387b97
BLAKE2b-256 d44cd2581b1ce6ef3726ee49ce3f90b8fb132763a947bb346561edb76b387257

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 9c59c154190da4f8390e76d4f60c5a77aed19f72d1d049eb04fa867080ee7cd8
MD5 391773e2f53f27eb4e901b283e3915e4
BLAKE2b-256 52003833909101ee2172d40d3f37907107eefce38b03ef2c4f140e9fba326122

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 45669084f6ee7cbe4e2b709a74cbe1b773580e616001246c8ba58204ec0330a1
MD5 2338eff3d1c86103725d2c93f6faf60a
BLAKE2b-256 f0987bd84c962a557dcc6d1f943d0e44456fd4ee0b46404cb3f0f15836a0f48a

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.4-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 2f1637d8589faa1633ee28dd0d9b8d9fe0ebf9aacb6bc819d9af7a88fc8a26ca
MD5 b2005b2bb2dda35dd08f0347d9acbc92
BLAKE2b-256 832c0f37068eb5b456a00df9b7a043dcbff79d8690bcf3c935ea6353bb8ed1b6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e30da650f5a7178cbe9ae7ad88b722812c70f038c9e49f32f7d81984b37771b3
MD5 304cdd46bd265de19437dfc41880265b
BLAKE2b-256 98008e7efbb439d5e235a3989f6bde0b37035d0a91e5b7e3d652dfd240f2b019

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 cb2df270628c82ef29d96254795b8317bc1fc93f84736784abbfd3e0971edfe3
MD5 0c1f153dd71efcda4e9f88f0f3084150
BLAKE2b-256 61d8dd49e61b7fef4a4b376f84d38bc83c3f84b0226bed952cbd54c878a1e6f2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 60e6958bb51547fc6eb8c29dc683779b0458c91bd35e829f84549e6fc2d6c74e
MD5 87bd01fe2a54388e2751aa4d3e016ced
BLAKE2b-256 09fa756245f5cdb475ad0ed5f435bb4c514acd56751dedc22904a90ab2f3bd88

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.4-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 38ca0a9e365acedfc6423fe2eae90d077848c29bbc83edf2d6e68acb163d2886
MD5 596c1cef84076f80e5bccb8b365f71ef
BLAKE2b-256 87276ff8ea4ff185e0539c17b6ed7d311e224169a9929c5aebc9d965988d130d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 790eeba021e1003b39b050a48e5ae71fbbd96f305f1a66e63c65748dd7a19ee2
MD5 a66b4250a1125434cda4747f9adc017a
BLAKE2b-256 277b5c3eafc9a6a1d395758339b7c925091cb6dbb9530d9fc51d66619e086fff

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2b7522db433aef3c23e4dc7ff6b7db47203f16d2fb300ed4b3cded0939b2e56d
MD5 71f4a0628ce8b0f3e73c3a21ff93baff
BLAKE2b-256 7aba3e3d9761376cbaeb8197322795a9de8317dd208a4ce6fab1f970bbd33aef

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0825552c6b7a05c311bdf0940d05ac96108e8da1593a8bac7a120db7be2fed7d
MD5 5f05ba14e42c83c82a328240415b5a52
BLAKE2b-256 ea5372c486ab09124ea15199db9731908a4a0db47bdb29551142ee63de97c0b0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.4-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 668a0f85ff3492f2716661d5201f4bd1c5d5e11c19cb9c5c680b7ce052a73dd0
MD5 b1a9b604451c10f0557c4c8926fab22d
BLAKE2b-256 38d6af85d16e41a34062d8f464a8c71df70d3171ab786d7abc8cbd0b73460959

See more details on using hashes here.

Provenance

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