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.0.tar.gz (474.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.0-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.0-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.0-cp313-cp313-macosx_11_0_arm64.whl (6.2 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rusty_haystack-0.7.0-cp313-cp313-macosx_10_12_x86_64.whl (6.5 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

rusty_haystack-0.7.0-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.0-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.0-cp312-cp312-macosx_11_0_arm64.whl (6.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rusty_haystack-0.7.0-cp312-cp312-macosx_10_12_x86_64.whl (6.5 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

rusty_haystack-0.7.0-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.0-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.0-cp311-cp311-macosx_11_0_arm64.whl (6.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rusty_haystack-0.7.0-cp311-cp311-macosx_10_12_x86_64.whl (6.5 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: rusty_haystack-0.7.0.tar.gz
  • Upload date:
  • Size: 474.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.0.tar.gz
Algorithm Hash digest
SHA256 5bc77f0587772e919d1bb0601c6abd7489ec1611680581418ddf132a0076dd9f
MD5 ad4b50bea66eecf4cba9a5b798195d51
BLAKE2b-256 bceac7c447eaff6bd867246958785118c10135e7ee154e8e19fe3a6e0f0fc4c2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.7.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 bb23958c23694ef240fd2000f83c2a1ae109345ea15ac2d2360df7d51ff613a2
MD5 68d7c92b29bf1ce9e718ce77911aad74
BLAKE2b-256 8fc70e6db560a8298e737622daa810f116911ce19d3ee8b95f786269f827c6a5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.7.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ae165b2d7923755421a3cdc207b6493b2cec4ed95f35dc164fd5d199c542ac8f
MD5 a0d0c1f5f4a67282b20f7effa142241e
BLAKE2b-256 bb2baf83455015d5a3100285ad62eb578b81644d7ea69e305a3b27c53cb7321d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.7.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 26b5e3ee015b8c724e1bc43bb7940c92f24f1bcb85f810fc7bfe7220e460d521
MD5 bd51adbe0bfe6e1201693a776b8da3b3
BLAKE2b-256 4ef9f5575cea96289fc3f71ed104beec840b6aa2d82f404d509bc309d75187ee

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.7.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1480218785c0a1df381b6d03ba4b3a0dbf3258bd124a10c0ba5eac433d2a682d
MD5 61d2928375128ed55ab2f62082c0f8ef
BLAKE2b-256 de756efc153b627cff7e5890bd8b61a278df95840877e0876d550f59e674a7f4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.7.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3bf101c5a2dad89603d5f69231f897a7035f26994f334637d79e751c64466c5b
MD5 81f42a4974f5887d296d742e0e1c1357
BLAKE2b-256 23906a5f5a9f3447eea61695a06087690c063861548ea4da1f7a4d9f94267151

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.7.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 4b849d21d32f4080f30fcc692c23d68e9a2b104525336c2e85403a0cdd97a00d
MD5 428a86f5a4bd113629717e9a24b79fe9
BLAKE2b-256 5412832b77384f6c37535cda3be8f72923f0e70607a415bd1e22a3e31c6cff6b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.7.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2eb54ccadf06570b86154575f1f21e2e60bc9c41afd1b39710c1ec2493660cad
MD5 d8ae5518d50e02731c2c70914cb4c1ce
BLAKE2b-256 80e1ba4ddb347b15896c1216c2c6f72b228453df4638c73f83b48acdcb10b010

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.7.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 39feb59d77ab17c7b8bf720615a96897ea99bab99a20284e9890ce1ff9407621
MD5 f515cb524d604ea7cdfd9c30d7bf955b
BLAKE2b-256 fbd277bc78b776046a168adadd291bafbfda4c83cebc281a5509a8ea33714652

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.7.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 32f7dbda4491f8d41b1bfba05c9f2d4cec2abac23092ece10ad4d905367e934b
MD5 eaddb18dd1f68393b57048d73ee1cfc1
BLAKE2b-256 a50faa4f2451efd486f38036c8a0f7cbae8f11f40412c6839fb69b09f1e06ca0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.7.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 faf51faf54be1218ac0abb57df778dc8f4ab0c609d3038f8ad326463e6eaf5dd
MD5 d3b50c664ac1dd2b4d996f9c40bbe7bf
BLAKE2b-256 12112b9cb8243f6179e5fbd01e12e92c3e0cb44a8b6cd03ff48d4f09f690a846

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.7.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8fa6c79744e8fb11d28cf1129f968a555efef449d84242251cfb00d309cabe06
MD5 3f75976b2bc9f43e816cce1a7e9f9900
BLAKE2b-256 6ec09c008402809aebe0284c623d407b012c6be0f1acd11c3d7f0708ef1eae1c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.7.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 f70ebe05c44f9f14552ca8f474629fb48972a134488086915440c326649bd05a
MD5 67e2171be66871e4fc05dc28aa963b35
BLAKE2b-256 6f7701b17067e7c3a2c5a83d57ca0fe58c1e53bfdef9f061b1b1ead6551e5868

See more details on using hashes here.

Provenance

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