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.4.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.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (939.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

rusty_haystack-0.4.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (893.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

rusty_haystack-0.4.4-cp313-cp313-macosx_11_0_arm64.whl (834.4 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rusty_haystack-0.4.4-cp313-cp313-macosx_10_12_x86_64.whl (856.4 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

rusty_haystack-0.4.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (940.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

rusty_haystack-0.4.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (894.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

rusty_haystack-0.4.4-cp312-cp312-macosx_11_0_arm64.whl (834.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rusty_haystack-0.4.4-cp312-cp312-macosx_10_12_x86_64.whl (856.6 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

rusty_haystack-0.4.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (936.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

rusty_haystack-0.4.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (889.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

rusty_haystack-0.4.4-cp311-cp311-macosx_10_12_x86_64.whl (865.5 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: rusty_haystack-0.4.4.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.4.tar.gz
Algorithm Hash digest
SHA256 f04d55800cdae1d8cc4060020b6986ca30421b4d8e0419e26d75511f16b64632
MD5 dacf03729ab72101671b4043c3a1ab67
BLAKE2b-256 adb348778a8a9775a1f6ac949fba4d095c4ff4bbb803dcfb1ae581e2195923d9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.4.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 308031b4403e158796555ab198b0c8b4714d21df51237c80a2b9db777ea29e79
MD5 1bb05e87259eb9e0765853b8112dc0fe
BLAKE2b-256 ae063cc23695b98070fe0a402d327b8cb26cf82e4a5ac43a69c959bb5f667bf0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.4.4-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c944ef6481968160f3d04f144c08a0b3ddc4dee4361dd600c17ca8457e605469
MD5 40f2a17731ed6c1bc90e00379e6ac969
BLAKE2b-256 0d68b6497d67f94a12c2b56d9dec4ae39888415aac2ef3c99c131965325f2dbc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.4.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d0eb25091024c934febb5adcb311419e8ea751d817317707983cf30d8bf9edb5
MD5 9d3b58984b7df15adf74b49578d8f237
BLAKE2b-256 96caf139db52dae35418ceb556f38ff4d6b55e81fba5677eb5a6162385e8f819

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.4.4-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 5008e8eb0df9210f8a790d763c054fc4b4f79ed0a32c15acbaf8648caf10f636
MD5 37ab40ac9ccfff9944d4e22643f8981b
BLAKE2b-256 60474845083e8cb827628f7f4e2552bbcc1c35c3a95fd995f7fb24510a14d3c8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.4.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 041f2d01bbedd673bd1b71f8db04af9270e743da59e547cb30d6a7544d4b9447
MD5 d26592d27447b9d35b57909457c3fb25
BLAKE2b-256 6ce6dcd18c860ccd9f5b64d6271402c4c3817c762f4506a3a05720df0436cc35

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.4.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 60538323666ad60b14a6461e39d0b39a69c23b34ea7c6a684cfcbd0a0b16413a
MD5 ef4935d30ff7f7360080052286f6b204
BLAKE2b-256 2e730e0e31bc4147bad9ea07afd812572a8499c83b614f1d98927a471755f1f4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.4.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 01ba567eb798a8e0eca0ca59aae2b5962db190c4b241d7e4ae11b85f31f30e1e
MD5 4bde6f2c2a38d2da78b386d24f6ad8cf
BLAKE2b-256 acb4f15bddc6ccf9a64ff863a58efc7f34514b8de177577e6d61bdb2e0a4a3c9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.4.4-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 46c62b167dcdcd76f80b5d52d04dd4ab2232d4069a7a8a3a862c6afc4b3d0341
MD5 4d1d9e301d270630a4206f9722880d92
BLAKE2b-256 2bcc026c2e1860a35df360d518b1b2df265b96b12d13b0041b76936678831db6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.4.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 265ccc18130df6b4314cb9bc01927ac433a0284d5e8b54738ecb77c41f267c83
MD5 4c1ac7577b7914ebacfddf3f7b457535
BLAKE2b-256 d9bee3d28c6bc833aca4f26430daef3291197f62c3b31f51e4ca65b9fdcb0e90

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.4.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 12ef70cca2742cbe52adfa6f1d588ccccb2eda38a17e813a7e2a4fca79876fe2
MD5 d5dac5f85150144068915923f4aa3a1b
BLAKE2b-256 db63cc13159b59ef91b33f4ca4300a67ef9ff31ffd85ce53b35496a2ad51b8fe

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.4.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0f496db691c9741b8ae49ee19c57aa3c489c7ec1ecc17f642269b408e31a0721
MD5 4f8e5396a9e74cd195628f7bae2c2d5c
BLAKE2b-256 92a7b0b4a8c476ef52742edc9df3e6f1142554b54ca6ce0b4ad39ffca9cbd366

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.4.4-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 409e48683f8dbc2be48fbbe38e96f8a328b3cadf639a6186989598af0ca28e4e
MD5 b1c19c97de499905ff9ac18d5a32bced
BLAKE2b-256 5601ff9333bef5a57c747df5bfb4caf603f6012c872500ea7919d81235e5f982

See more details on using hashes here.

Provenance

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