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.3.tar.gz (408.7 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.3-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.3-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.3-cp313-cp313-macosx_11_0_arm64.whl (5.9 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rusty_haystack-0.5.3-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.3-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.3-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.3-cp312-cp312-macosx_11_0_arm64.whl (5.9 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rusty_haystack-0.5.3-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.3-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.3-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.3-cp311-cp311-macosx_11_0_arm64.whl (5.9 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rusty_haystack-0.5.3-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.3.tar.gz.

File metadata

  • Download URL: rusty_haystack-0.5.3.tar.gz
  • Upload date:
  • Size: 408.7 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.3.tar.gz
Algorithm Hash digest
SHA256 efe712c3c168bf75b4e776e43bc098b8135a88669461737c05280bf5a3ac2c97
MD5 ee306176226584141b601372fd10bd34
BLAKE2b-256 463afb122dd5a53b2369131bf3c93587ddfc8a4f678cdfb5a1f654eb42918ea1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 00a4bc32749b4416c9b08ac78fe98423b4b69667f8ff8aa260260fd2ce8db5a9
MD5 59679b6cf5fe9b7b40a0ea282c2d77a8
BLAKE2b-256 4c816b1f70aade81521f539dde22c97f71caa13a36b77e1073a1d414b3743a5f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.3-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 364fb9d17e38f22030b93798a9d34cf9fb5565f98b002a03b395c6560d166b30
MD5 826555faf36fbd4f2fc44d1440580e8a
BLAKE2b-256 6646c516c2ff3b1a0c314816bb31521f7036460d15a6057190b10b831d375e91

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3f2d8f51111a727ec7c91a5ef89a0542d9ddd823d66bb35e72688bec88a9230a
MD5 d754b854229a9fb116f12e4ae4a43a0f
BLAKE2b-256 b19fdc47363773d41f332f0c16da49e003b229d183f2c96248a1f02fcb362837

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.3-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1a874981d78aa0288c1a422efd5f30fc842a0168d9b43177b3128ba718a9bbb7
MD5 fc906994d5d180d0553f93980f333d43
BLAKE2b-256 88a4ac0bb82f35db2c34c7a62cd98aaadbc54deeb65d18c795c3c322c71ebd51

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6543b4b64cd1721d16d0e156230591e893e3014f6a71af8ed0d87437f40ffc71
MD5 6ee1491be3123236fd24bb92cb2683ec
BLAKE2b-256 080f29a6b89d711133789c2699b8a032102c8d8482cdb7321ead091a838accbb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b0e3ad20e7f9efccb598d1bfc12c4205b8117fd0ee09b083cc8d260c686e6253
MD5 722b97a86af760d264d9f2a9f8a3c67d
BLAKE2b-256 1d1783c825cf6c24263731f023da1344e4a2ad2c80b8730c32854b4675d94130

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 85db5be52c2494ee3d023d75b3cdf6c195071f559f254ed3c423cb33c506257b
MD5 5f1196af8b29f6352776f3ae1d746681
BLAKE2b-256 ef852ca2fa556361a625518a408064879589216f9b1507acb1683c1f209af3f4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.3-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e5fff9a5680e5a08efcdd1a7b0921a41a0559e13faae2a29345e3e14610f7423
MD5 a495e497df7680c549247a0e4eeeacde
BLAKE2b-256 de3a9c95cdf21d7db2a87f8cacc64742330986802cbccdcdd6613fae127ceaf8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fc6fed99878d2848d0c085245752f0d68930559b37b4ed7536bfc5cec0aafc99
MD5 f9607fceabdff26ea856aad740ad0bda
BLAKE2b-256 f193d54334cc97c1353a9ab44c75b6131c4e01fcfcc1545b9671c44dc3466fa7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 2c9571d06d054538d93ad0678c0e722721ac35aec7eadcf83e2e5b3615ee8f47
MD5 41af85254018c1d9bc44ceb56321c486
BLAKE2b-256 849d17ef7a0efa999c9ff870f1e7a598acb1205155f317f194a9473f55a73acf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b58f4b79516f90f4eb1e8ebbedeb67d0716004a930c73462fa6d8bf1d9069352
MD5 ae076ce96fb31162acd7009b027af691
BLAKE2b-256 0a71bd1f1d287025735d26b2306cae29f55e32ef920458cfd77c2f8e6a37683b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.3-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f8b11518aeac98f230c71c1233a5cc3b33cfd165762de444dd6f6edcb91e150f
MD5 5ca98a0efe9e04192043eccb98a9ad4b
BLAKE2b-256 3c4c99a49a75c0d8c2ccd2a943e0082ebe26b24eedcac53dcc491a868167bb3b

See more details on using hashes here.

Provenance

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