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.3.1.tar.gz (273.1 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.3.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (939.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

rusty_haystack-0.3.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (894.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

rusty_haystack-0.3.1-cp313-cp313-macosx_11_0_arm64.whl (834.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rusty_haystack-0.3.1-cp313-cp313-macosx_10_12_x86_64.whl (857.1 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

rusty_haystack-0.3.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (940.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

rusty_haystack-0.3.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (894.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

rusty_haystack-0.3.1-cp312-cp312-macosx_11_0_arm64.whl (834.3 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rusty_haystack-0.3.1-cp312-cp312-macosx_10_12_x86_64.whl (857.3 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

rusty_haystack-0.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (936.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

rusty_haystack-0.3.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (890.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

rusty_haystack-0.3.1-cp311-cp311-macosx_11_0_arm64.whl (839.9 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rusty_haystack-0.3.1-cp311-cp311-macosx_10_12_x86_64.whl (866.8 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: rusty_haystack-0.3.1.tar.gz
  • Upload date:
  • Size: 273.1 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.3.1.tar.gz
Algorithm Hash digest
SHA256 41dbfff1f5803fa15644eef2495c805826a8be9eb9ab7ead1eeedc6b3286b5f0
MD5 f3f056ac1eea3dbe0c7df4e2e8875fdb
BLAKE2b-256 62691965b30429411d84c7098625f82710362a1abcb359938ecf773309aeada6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f3a698dfc41b3a7a5748529ee0452b3e337de72d8194c3debe0793b73df1579f
MD5 aae9f0255291be082f2fb378cea13ad9
BLAKE2b-256 5cb080ef49c1d2f7e45ff954c72aa3140dc86bde1e2924297ff7e43b3fbd0922

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 42401be033338ef9e096f97b9af73b32434feff463f9b4cb7ce65c962875184c
MD5 049a8a4dc3ab3a9ffeb92e46f9d245a4
BLAKE2b-256 c3a6306015400aa5e951ad2ab3af0ec5eee81e8d7caef33c909dfc5c464469e9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ac0e26c88e11ea83abbf4552e0793978fd0436aa88ae7c03ffe9b62e25b2fe4
MD5 f0d7c50ea605c51ee7ba35158fb87e10
BLAKE2b-256 766faa7887b051906dc53c4dd37bd4b7655da5c36db67ec1056f3e0d5a4a70d5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.1-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1392f07f77107b684646c3adad795bd8b3a342df96a0b2e6ca12f3d02263c817
MD5 bfad5d894ad2bfa13e1996033c95f6cf
BLAKE2b-256 13075c0d3288a19749327cb389b050b3eaf3ff6d4dc0a3e3a9ee28bd3fd55dae

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6e07344186aa1872bbcf0af9d3775090489ff08095f50b6d81809b921ea9a95f
MD5 43260dd7e903179ba2278f0c3902c668
BLAKE2b-256 d5ee52192860eacdd8ee170b038f714c2121bc71052f1ad83e7d6b2fe087f3a9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bd6e0567789350a2a80d2cfd0ad491cecd4950062e027e75cb6ea42821545f16
MD5 6d8fb8ef7d5ab91e0f87309cec71ca15
BLAKE2b-256 05341eaa03818ab3475b1be20792d7b227127632b3b4400bb25243beb9a207c4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6f2e34a9d48353ed06624a16d605dc70046df8e7b077c5b64ea66f3a8339539b
MD5 79815b58a4f1775792b6541be42bd294
BLAKE2b-256 31ec091e1f8a8f4295173e55a3b3d91574a2ca2cae92e633b74caf8daf5e14df

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 6863d02636f53b73df5695eb3d60da67ad9601b405db0cfb9c595ef8b9f4502a
MD5 6308ba7dee742fda36ec1f0f16fafae8
BLAKE2b-256 b644ded22a628379661b65dbc6cc7d1670725427ef8ac623e5248aeb12ea3459

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0d36b60971b5e3ae3e053e18ab3d4b03c036eb457364aa54b54f2f57245724ca
MD5 2a8e69a090dc0731f6bf45b07bdcbd3b
BLAKE2b-256 cbd00a9cdf0128c40237166acb3ae00704b5ce32e51a656b2d5e420548a4d35c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 974727b087465bcd12f9546d268d21a61bfca4620358878a26cbaac967c020f2
MD5 e3817757d72eb6280bd406c9d62d2b6e
BLAKE2b-256 0af8c38135dff850c55a01d6bb25e4c6b4db8df88e74b984480b5e6be4ce5eb2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 951026f27bdcc3132b85f8adfe55ef83735c0f94d8dd6f450e63374d02153908
MD5 8ae47abcaf80f40d5ed49ea45efca356
BLAKE2b-256 3bf2667c8ce79ee7a33b7907ee21b2a7709d02b71177b3dbe30cecb4f0455a14

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.1-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e599dcdaf47b8e55cca191cb719153047af4b7a2586f17a7c2bbe04a53cc096a
MD5 7ea8fd5ffee68e1952157807859b4513
BLAKE2b-256 8dfdc53bbf680de5053d9c4d1b680f6e399acb6f83517f627bd0e6ce97e0169b

See more details on using hashes here.

Provenance

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