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.1.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.1-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.1-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.1-cp313-cp313-macosx_11_0_arm64.whl (5.9 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11macOS 11.0+ ARM64

rusty_haystack-0.5.1-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.1.tar.gz.

File metadata

  • Download URL: rusty_haystack-0.5.1.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.1.tar.gz
Algorithm Hash digest
SHA256 d584fb1e7f5f9850534338544b8e41dedaf19dfe9e23246511140f865a5b31b6
MD5 96535a9e05e61b629b43e48772820fcd
BLAKE2b-256 8eea88bd454dae42c7b4cf3f496f2d1b43b51643f9b999b5f318d12c45742488

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 10838dc81d1acd710cdb663bc2e8864827ec9f13b3f8a49e01b761946a6683f6
MD5 ba46477913f86bb5260399a53f473566
BLAKE2b-256 86b72c3aa671755c8048c04fd7b1f2c65d4702cac98027f9f82eb2ac55104380

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 f52c3f4a811e979c482cdbaeaf7aba27a3c3fa72ed63901cdbbfa4ec6800f4ef
MD5 809f26e1de1608b6aeae3e1a7a27ae77
BLAKE2b-256 1d6dcb3b65b15064c43c7199bbcee7cfb291af9a46ace7a3778d88780704d9d9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 24a7fb811607f31dffc60909bbc2fcb03c4f5d8976aea08f96afcf1b22bb7875
MD5 ef6aa86aaa7c6fc033751ddb8fe13551
BLAKE2b-256 58413c1886408dadbcfe50ae7054865bd9658d37a7d2aa5a91fd601c653a8a1f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.1-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 31ba64d3cc81722019c1bbe6e013fa3dfc9a9a6ee007c91d1d27f965f5bdeb2f
MD5 4da2b008a5fcd60698d111ef32ec9d78
BLAKE2b-256 62321ed43d2f2c8bbbdabede372d85287f2418eadbe9f609d2d5aa5e93673aae

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 02da7ba4bf7411df53bf54b11b654b9d742525bff9ef00df464ac187dac5c427
MD5 e3de305a370face0f61b314892df8f76
BLAKE2b-256 6d5542c1524542df2f3602a0822f4f1a5a110ae2032a777281233ebda7b923b3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ef052e3c9a98110b8077e591267e054665ae3825e275d5264046f1318dfc3463
MD5 99bb8bb565c5b3f9690c0d53d3d13bab
BLAKE2b-256 d4ffbd411b576a77687ed7b44a1e6e687517e7ffb18f73c9247b48d5abdf8cc9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6bdbb30c9fdf9f64324208019b533972a2f2d88c643de17b3a2ccc93f75340d9
MD5 e58159a8521b387a7182b30f91ddaddd
BLAKE2b-256 32168b1f48e72ea633e87aa0dacb3bed9f1fba9b0e5e2b082a77f4c623bb6f82

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6b53c44e79390a29e4968e4c0e0d6f42c298e0e7acd9734a1bbc4f55bd5fc7fb
MD5 4fcb68b923b074cec185568293531cb3
BLAKE2b-256 339a1d278b468854cb8039117ac598ceb6223c152ac7fc84a6761937e61665bf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 427e0ebb448c25566162d119dd90c84ed7f1de7c084cb0959fc7efbdff0399b1
MD5 efc20951611b5f9480decdcbf34d3de2
BLAKE2b-256 5d0bc67f84d310b034fd637a27d27a0df39c0ea838e38ecd117a0572dde07f9c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 008bdc107b64481db6d808b51cb2ab9af32e41af109b01452f1a28c03a2b517e
MD5 6535cf3db0b533434cb072e518d3e183
BLAKE2b-256 803f318758f3ddb2e0625fcbf402969cc7cb1ff790c406269915a46497994e99

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8ee447bcbf07fd95a8193ce3dd42396738b646cdb09bf92b0b8b6a649183e728
MD5 6848b9bc317161120222b30a9ff9e938
BLAKE2b-256 0a1c22c45f9e38795d491f54c4f3e9db6e398801afb725d3efc1c80dc9f67509

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.5.1-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 fc7a14a21e568264d86685425b109f6c976c435f228e3f49e055a81e5043a1a6
MD5 2b51c3dfb6240f5c8fa1e356093d5c82
BLAKE2b-256 7413a6c8057a87b293fdf143d5e3aee92c92352151627a760081e2d28f27f2d5

See more details on using hashes here.

Provenance

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