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

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

rusty_haystack-0.3.2-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.2-cp313-cp313-macosx_11_0_arm64.whl (834.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

rusty_haystack-0.3.2-cp313-cp313-macosx_10_12_x86_64.whl (856.9 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

rusty_haystack-0.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (940.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

rusty_haystack-0.3.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (894.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

rusty_haystack-0.3.2-cp312-cp312-macosx_11_0_arm64.whl (834.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

rusty_haystack-0.3.2-cp312-cp312-macosx_10_12_x86_64.whl (857.1 kB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

rusty_haystack-0.3.2-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.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (890.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

rusty_haystack-0.3.2-cp311-cp311-macosx_11_0_arm64.whl (840.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

rusty_haystack-0.3.2-cp311-cp311-macosx_10_12_x86_64.whl (866.4 kB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: rusty_haystack-0.3.2.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.2.tar.gz
Algorithm Hash digest
SHA256 eb5780743574f745997e4abe0531cb6beb12b175cfb5d5315d0b24c730fc4083
MD5 1bd1179ecc949881c25d2752730fc674
BLAKE2b-256 b61782e05abbcd8906bfe04a7a5c20cbd9e269c47283d30f251c7ae7e261f069

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 5522f4a27eb52c50565dd386e438df881a9461860cdc92b483688f3d6fb42a01
MD5 b8ded1902cd8b8063a604e27dbd402e7
BLAKE2b-256 0f7dad16767661532ca774ea8585265979d785c48fed8926253ad19aa39d0a62

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c3eac98eb69d68b26e0f20a8f51fe6d3588d0d6f7300235d363c8b37be057815
MD5 51ea77c40fc92332bb5f27c9c19b172f
BLAKE2b-256 f901eea245924b29058ee07c4a92a8c57386f918e795d1bad5d958a09f8931f9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5b8a43f6ded05a800035fc04bb4547ae22606713f318e2edeb51c282f3d46f25
MD5 2beeddbb41a44f31da108d74856eef89
BLAKE2b-256 adb90cacc4bd010028cfaede74ccfc73e0d011aa1b9b94eca36260b2295ef5b1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.2-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4f4592f30db99e083f97811b7d519b3c837e1e05470a32707ed0d19c93eeaf21
MD5 91b4b6b932c382fc5dd6206ee73ea226
BLAKE2b-256 04583bdab8ebf19bc615cd6349bca7632bd8b075e7372b7d4abe11d97ef26da2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f7bfa0d1b6a6450a2ec1dd2a37caeca18eba4ebdb6e8e325e44d39d8e8754285
MD5 08a043cdb62918dbf9bf60cb86e1fbd2
BLAKE2b-256 5a6729a652f6cb27324abfe9fce03265e3b09828fd48fc7a5d7bc4ce5bc9761b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 bdccf3fa59e81217355e33426d0a8ea3a744943c71f31c4750caa82fa8dad42b
MD5 b60bb946a6a7990eea97f52f44e5d25d
BLAKE2b-256 86ceb99d57fc63af667b05f653de38a042cc38501451ace4bddcaaedae698379

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7eb648a04ebf2742fbf6980502bfa0110a623925f28870595e0d5932fc544be5
MD5 d1b98ac6b8d0d1504c3c00916811e3bb
BLAKE2b-256 aeadea88d77b4c4a855ab53cea3c1f1a29d55d09dbf119437944e71a6b3be395

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.2-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8aed76268df9e3550048b44e98604aa497d9162bf2c1125a25dac91af113826e
MD5 17b28eaaa819b286c0379b0f1c2a0d7f
BLAKE2b-256 e2ccdac920d27494930669af71f1a04ae2ae8bf1fc4cdaebfa15958f8ba5f601

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a5e11b4019201c5e1031ba2132ed81ae471431d7b0fde4ce5f98be6d23f1e1e5
MD5 e3de2c6454b0818109c6ee69727d4b80
BLAKE2b-256 92cbb1a844336822ad3760258cd0f4c51206e3018f9cfe15520699e7e368d97f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 dba00b5844973db697de4d8a0a0165f2fed1b129fc117262dcc0d054344b5b94
MD5 06a0cd7065fe64bf84fffab23b580327
BLAKE2b-256 d6ebe7fe81a7f4f70ddca950c2df42795823347eafdb952ecda697269adb810b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fa927fb0455eb0b3150877e1dbe1c22d198ec16ebe2da327e36c2825cf312e9d
MD5 817b9f0b98c0f989acd584c855f8a3c8
BLAKE2b-256 5b3d847b1ffaa48e2e903fda2f816272859226cd6140fc6b80a76500cddad966

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for rusty_haystack-0.3.2-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ccd6ed9faeb0aa5423cd258fe7d36457f9ea5346dd6b5939864e3c570f4bc727
MD5 8084914d58cb95e2ae68a671b4b41e49
BLAKE2b-256 0ead05e742a64ec24154f8811567030de13b62963584d59289d94c3c9a1f289e

See more details on using hashes here.

Provenance

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