rusty-haystack 0.3.0__tar.gz → 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/Cargo.lock +5 -5
  2. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/Cargo.toml +1 -1
  3. rusty_haystack-0.3.2/PKG-INFO +116 -0
  4. rusty_haystack-0.3.2/README.md +96 -0
  5. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/Cargo.toml +3 -0
  6. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/pyproject.toml +3 -2
  7. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/rusty-haystack/Cargo.toml +2 -1
  8. rusty_haystack-0.3.2/rusty-haystack/README.md +96 -0
  9. rusty_haystack-0.3.0/PKG-INFO +0 -17
  10. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/benches/benchmarks.rs +0 -0
  11. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/data/defs.trio +0 -0
  12. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/data/tz_map.txt +0 -0
  13. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/data/units.txt +0 -0
  14. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/data/xeto/ph.attrs.xeto +0 -0
  15. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/data/xeto/ph.equips.xeto +0 -0
  16. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/data/xeto/ph.examples.xeto +0 -0
  17. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/data/xeto/ph.points.elec.xeto +0 -0
  18. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/data/xeto/ph.points.xeto +0 -0
  19. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/data/xeto/ph.protocols.xeto +0 -0
  20. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/data/xeto/ph.xeto +0 -0
  21. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/data/xeto/sys.api.xeto +0 -0
  22. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/data/xeto/sys.comp.xeto +0 -0
  23. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/data/xeto/sys.files.xeto +0 -0
  24. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/data/xeto/sys.template.xeto +0 -0
  25. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/data/xeto/sys.xeto +0 -0
  26. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/auth.rs +0 -0
  27. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/codecs/csv.rs +0 -0
  28. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/codecs/json/mod.rs +0 -0
  29. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/codecs/json/v3.rs +0 -0
  30. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/codecs/json/v4.rs +0 -0
  31. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/codecs/mod.rs +0 -0
  32. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/codecs/rdf.rs +0 -0
  33. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/codecs/shared.rs +0 -0
  34. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/codecs/trio/encoder.rs +0 -0
  35. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/codecs/trio/mod.rs +0 -0
  36. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/codecs/trio/parser.rs +0 -0
  37. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/codecs/zinc/encoder.rs +0 -0
  38. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/codecs/zinc/mod.rs +0 -0
  39. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/codecs/zinc/parser.rs +0 -0
  40. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/data/dict.rs +0 -0
  41. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/data/grid.rs +0 -0
  42. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/data/list.rs +0 -0
  43. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/data/mod.rs +0 -0
  44. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/filter/ast.rs +0 -0
  45. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/filter/eval.rs +0 -0
  46. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/filter/mod.rs +0 -0
  47. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/filter/parser.rs +0 -0
  48. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/graph/adjacency.rs +0 -0
  49. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/graph/bitmap.rs +0 -0
  50. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/graph/changelog.rs +0 -0
  51. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/graph/entity_graph.rs +0 -0
  52. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/graph/mod.rs +0 -0
  53. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/graph/query_planner.rs +0 -0
  54. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/graph/shared.rs +0 -0
  55. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/kinds/coord.rs +0 -0
  56. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/kinds/datetime.rs +0 -0
  57. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/kinds/kind.rs +0 -0
  58. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/kinds/mod.rs +0 -0
  59. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/kinds/number.rs +0 -0
  60. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/kinds/ref_.rs +0 -0
  61. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/kinds/singletons.rs +0 -0
  62. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/kinds/symbol.rs +0 -0
  63. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/kinds/tz.rs +0 -0
  64. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/kinds/units.rs +0 -0
  65. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/kinds/uri.rs +0 -0
  66. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/kinds/xstr.rs +0 -0
  67. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/lib.rs +0 -0
  68. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/ontology/conjunct.rs +0 -0
  69. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/ontology/def.rs +0 -0
  70. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/ontology/lib.rs +0 -0
  71. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/ontology/mod.rs +0 -0
  72. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/ontology/namespace.rs +0 -0
  73. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/ontology/taxonomy.rs +0 -0
  74. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/ontology/trio_loader.rs +0 -0
  75. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/ontology/validation.rs +0 -0
  76. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/xeto/ast.rs +0 -0
  77. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/xeto/bundled.rs +0 -0
  78. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/xeto/export.rs +0 -0
  79. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/xeto/fitting.rs +0 -0
  80. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/xeto/lexer.rs +0 -0
  81. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/xeto/loader.rs +0 -0
  82. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/xeto/mod.rs +0 -0
  83. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/xeto/parser.rs +0 -0
  84. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/xeto/resolver.rs +0 -0
  85. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/src/xeto/spec.rs +0 -0
  86. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/tests/e2e.rs +0 -0
  87. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/tests/graph_integration.rs +0 -0
  88. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/haystack-core/tests/ontology_integration.rs +0 -0
  89. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/rusty-haystack/src/codecs.rs +0 -0
  90. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/rusty-haystack/src/convert.rs +0 -0
  91. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/rusty-haystack/src/data.rs +0 -0
  92. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/rusty-haystack/src/filter.rs +0 -0
  93. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/rusty-haystack/src/graph.rs +0 -0
  94. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/rusty-haystack/src/kinds.rs +0 -0
  95. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/rusty-haystack/src/lib.rs +0 -0
  96. {rusty_haystack-0.3.0 → rusty_haystack-0.3.2}/rusty-haystack/src/ontology.rs +0 -0
@@ -2072,7 +2072,7 @@ dependencies = [
2072
2072
 
2073
2073
  [[package]]
2074
2074
  name = "rusty-haystack"
2075
- version = "0.3.0"
2075
+ version = "0.3.2"
2076
2076
  dependencies = [
2077
2077
  "chrono",
2078
2078
  "pyo3",
@@ -2081,7 +2081,7 @@ dependencies = [
2081
2081
 
2082
2082
  [[package]]
2083
2083
  name = "rusty-haystack-cli"
2084
- version = "0.3.0"
2084
+ version = "0.3.2"
2085
2085
  dependencies = [
2086
2086
  "clap",
2087
2087
  "rusty-haystack-client",
@@ -2094,7 +2094,7 @@ dependencies = [
2094
2094
 
2095
2095
  [[package]]
2096
2096
  name = "rusty-haystack-client"
2097
- version = "0.3.0"
2097
+ version = "0.3.2"
2098
2098
  dependencies = [
2099
2099
  "base64",
2100
2100
  "futures-util",
@@ -2111,7 +2111,7 @@ dependencies = [
2111
2111
 
2112
2112
  [[package]]
2113
2113
  name = "rusty-haystack-core"
2114
- version = "0.3.0"
2114
+ version = "0.3.2"
2115
2115
  dependencies = [
2116
2116
  "base64",
2117
2117
  "chrono",
@@ -2136,7 +2136,7 @@ dependencies = [
2136
2136
 
2137
2137
  [[package]]
2138
2138
  name = "rusty-haystack-server"
2139
- version = "0.3.0"
2139
+ version = "0.3.2"
2140
2140
  dependencies = [
2141
2141
  "actix-http",
2142
2142
  "actix-rt",
@@ -3,7 +3,7 @@ resolver = "2"
3
3
  members = ["haystack-core", "rusty-haystack"]
4
4
 
5
5
  [workspace.package]
6
- version = "0.3.0"
6
+ version = "0.3.2"
7
7
  edition = "2024"
8
8
  rust-version = "1.93"
9
9
  license = "MIT"
@@ -0,0 +1,116 @@
1
+ Metadata-Version: 2.4
2
+ Name: rusty-haystack
3
+ Version: 0.3.2
4
+ Classifier: Programming Language :: Rust
5
+ Classifier: Programming Language :: Python :: Implementation :: CPython
6
+ Classifier: Programming Language :: Python :: 3.11
7
+ Classifier: Programming Language :: Python :: 3.12
8
+ Classifier: Programming Language :: Python :: 3.13
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Topic :: Software Development :: Libraries
11
+ Summary: Fast Python bindings for Project Haystack — types, codecs (Zinc/Trio/JSON), filters, ontology, and Xeto support powered by Rust
12
+ Keywords: haystack,iot,building-automation,smart-buildings
13
+ Author-email: Justin Scott <jscott3201@gmail.com>
14
+ License: MIT
15
+ Requires-Python: >=3.11
16
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
17
+ Project-URL: Homepage, https://github.com/justinscott/rusty-haystack
18
+ Project-URL: Repository, https://github.com/justinscott/rusty-haystack
19
+
20
+ # rusty-haystack
21
+
22
+ Fast Python bindings for [Project Haystack](https://project-haystack.org) powered by Rust.
23
+
24
+ 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.
25
+
26
+ ## Installation
27
+
28
+ ```sh
29
+ pip install rusty-haystack
30
+ ```
31
+
32
+ Requires Python 3.11+. Pre-built wheels are available for Linux and macOS (x86_64 and aarch64).
33
+
34
+ ## Quick Start
35
+
36
+ ```python
37
+ import rusty_haystack as rh
38
+
39
+ # Create an entity
40
+ entity = rh.HDict({
41
+ "id": rh.Ref("site-1", "Demo Site"),
42
+ "site": rh.Marker(),
43
+ "dis": "Demo Site",
44
+ "area": rh.Number(5000, "ft²"),
45
+ "geoCoord": rh.Coord(40.7128, -74.0060),
46
+ })
47
+
48
+ # Build a graph and query it
49
+ graph = rh.EntityGraph()
50
+ graph.add(entity)
51
+ results = graph.read("site")
52
+
53
+ # Encode/decode across formats
54
+ zinc_str = rh.encode_grid("text/zinc", results)
55
+ json_str = rh.encode_grid("application/json", results)
56
+ decoded = rh.decode_grid("text/zinc", zinc_str)
57
+
58
+ # Validate against the standard ontology
59
+ ns = rh.DefNamespace.load_standard()
60
+ issues = ns.validate_entity(entity)
61
+ ```
62
+
63
+ ## Features
64
+
65
+ - **Kind types** — Marker, NA, Remove, Number (with units), Ref, Uri, Symbol, XStr, Coord, HDateTime, HDict, HGrid, HList
66
+ - **Codecs** — Zinc, Trio, JSON, JSON v3, CSV encoding and decoding
67
+ - **Filters** — Parse and evaluate Haystack filter expressions against entities
68
+ - **EntityGraph** — In-memory graph with CRUD, filter queries, and ref traversal
69
+ - **Ontology** — DefNamespace with `is_a`, `fits`, `validate_entity`, subtype/supertype queries
70
+ - **Xeto** — Load/unload Xeto libraries, inspect specs and slots, export to Xeto source
71
+
72
+ ## Codecs
73
+
74
+ Supported MIME types: `"text/zinc"`, `"text/trio"`, `"application/json"`, `"application/json;v=3"`, `"text/csv"`.
75
+
76
+ ```python
77
+ # Grid encode/decode
78
+ zinc_str = rh.encode_grid("text/zinc", grid)
79
+ grid = rh.decode_grid("text/zinc", zinc_str)
80
+
81
+ # Scalar encode/decode
82
+ s = rh.encode_scalar("text/zinc", rh.Number(72.5, "°F"))
83
+ v = rh.decode_scalar("text/zinc", s)
84
+ ```
85
+
86
+ ## EntityGraph
87
+
88
+ ```python
89
+ graph = rh.EntityGraph()
90
+ graph.add(rh.HDict({"id": rh.Ref("site-1"), "site": rh.Marker(), "dis": "HQ"}))
91
+ graph.add(rh.HDict({"id": rh.Ref("ahu-1"), "equip": rh.Marker(), "siteRef": rh.Ref("site-1")}))
92
+
93
+ results = graph.read("equip") # filter query
94
+ graph.refs_from("ahu-1") # -> ["site-1"]
95
+ graph.refs_to("site-1") # -> ["ahu-1"]
96
+ ```
97
+
98
+ ## Ontology & Xeto
99
+
100
+ ```python
101
+ ns = rh.DefNamespace.load_standard()
102
+
103
+ ns.is_a("ahu", "equip") # True
104
+ ns.fits(entity, "site") # True
105
+ ns.subtypes("equip") # ["ahu", "vav", ...]
106
+ ns.validate_entity(entity) # list of issue strings
107
+
108
+ # Load custom Xeto libraries
109
+ ns.load_xeto(source_text, "myLib")
110
+ spec = ns.get_spec("myLib::MyType")
111
+ ```
112
+
113
+ ## License
114
+
115
+ MIT
116
+
@@ -0,0 +1,96 @@
1
+ # rusty-haystack
2
+
3
+ Fast Python bindings for [Project Haystack](https://project-haystack.org) powered by Rust.
4
+
5
+ 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.
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ pip install rusty-haystack
11
+ ```
12
+
13
+ Requires Python 3.11+. Pre-built wheels are available for Linux and macOS (x86_64 and aarch64).
14
+
15
+ ## Quick Start
16
+
17
+ ```python
18
+ import rusty_haystack as rh
19
+
20
+ # Create an entity
21
+ entity = rh.HDict({
22
+ "id": rh.Ref("site-1", "Demo Site"),
23
+ "site": rh.Marker(),
24
+ "dis": "Demo Site",
25
+ "area": rh.Number(5000, "ft²"),
26
+ "geoCoord": rh.Coord(40.7128, -74.0060),
27
+ })
28
+
29
+ # Build a graph and query it
30
+ graph = rh.EntityGraph()
31
+ graph.add(entity)
32
+ results = graph.read("site")
33
+
34
+ # Encode/decode across formats
35
+ zinc_str = rh.encode_grid("text/zinc", results)
36
+ json_str = rh.encode_grid("application/json", results)
37
+ decoded = rh.decode_grid("text/zinc", zinc_str)
38
+
39
+ # Validate against the standard ontology
40
+ ns = rh.DefNamespace.load_standard()
41
+ issues = ns.validate_entity(entity)
42
+ ```
43
+
44
+ ## Features
45
+
46
+ - **Kind types** — Marker, NA, Remove, Number (with units), Ref, Uri, Symbol, XStr, Coord, HDateTime, HDict, HGrid, HList
47
+ - **Codecs** — Zinc, Trio, JSON, JSON v3, CSV encoding and decoding
48
+ - **Filters** — Parse and evaluate Haystack filter expressions against entities
49
+ - **EntityGraph** — In-memory graph with CRUD, filter queries, and ref traversal
50
+ - **Ontology** — DefNamespace with `is_a`, `fits`, `validate_entity`, subtype/supertype queries
51
+ - **Xeto** — Load/unload Xeto libraries, inspect specs and slots, export to Xeto source
52
+
53
+ ## Codecs
54
+
55
+ Supported MIME types: `"text/zinc"`, `"text/trio"`, `"application/json"`, `"application/json;v=3"`, `"text/csv"`.
56
+
57
+ ```python
58
+ # Grid encode/decode
59
+ zinc_str = rh.encode_grid("text/zinc", grid)
60
+ grid = rh.decode_grid("text/zinc", zinc_str)
61
+
62
+ # Scalar encode/decode
63
+ s = rh.encode_scalar("text/zinc", rh.Number(72.5, "°F"))
64
+ v = rh.decode_scalar("text/zinc", s)
65
+ ```
66
+
67
+ ## EntityGraph
68
+
69
+ ```python
70
+ graph = rh.EntityGraph()
71
+ graph.add(rh.HDict({"id": rh.Ref("site-1"), "site": rh.Marker(), "dis": "HQ"}))
72
+ graph.add(rh.HDict({"id": rh.Ref("ahu-1"), "equip": rh.Marker(), "siteRef": rh.Ref("site-1")}))
73
+
74
+ results = graph.read("equip") # filter query
75
+ graph.refs_from("ahu-1") # -> ["site-1"]
76
+ graph.refs_to("site-1") # -> ["ahu-1"]
77
+ ```
78
+
79
+ ## Ontology & Xeto
80
+
81
+ ```python
82
+ ns = rh.DefNamespace.load_standard()
83
+
84
+ ns.is_a("ahu", "equip") # True
85
+ ns.fits(entity, "site") # True
86
+ ns.subtypes("equip") # ["ahu", "vav", ...]
87
+ ns.validate_entity(entity) # list of issue strings
88
+
89
+ # Load custom Xeto libraries
90
+ ns.load_xeto(source_text, "myLib")
91
+ spec = ns.get_spec("myLib::MyType")
92
+ ```
93
+
94
+ ## License
95
+
96
+ MIT
@@ -9,6 +9,9 @@ license.workspace = true
9
9
  keywords.workspace = true
10
10
  categories.workspace = true
11
11
 
12
+ [lib]
13
+ name = "haystack_core"
14
+
12
15
  [dependencies]
13
16
  chrono = { version = "0.4", features = ["serde"] }
14
17
  serde = { version = "1.0", features = ["derive"] }
@@ -4,8 +4,9 @@ build-backend = "maturin"
4
4
 
5
5
  [project]
6
6
  name = "rusty-haystack"
7
- version = "0.3.0"
8
- description = "Python bindings for the Rusty Haystack Project Haystack implementation"
7
+ version = "0.3.2"
8
+ description = "Fast Python bindings for Project Haystack types, codecs (Zinc/Trio/JSON), filters, ontology, and Xeto support powered by Rust"
9
+ readme = "README.md"
9
10
  requires-python = ">=3.11"
10
11
  license = {text = "MIT"}
11
12
  authors = [{name = "Justin Scott", email = "jscott3201@gmail.com"}]
@@ -2,12 +2,13 @@
2
2
  name = "rusty-haystack"
3
3
  version.workspace = true
4
4
  edition.workspace = true
5
+ readme = "README.md"
5
6
 
6
7
  [lib]
7
8
  name = "rusty_haystack"
8
9
  crate-type = ["cdylib"]
9
10
 
10
11
  [dependencies]
11
- haystack-core = { package = "rusty-haystack-core", path = "../haystack-core" }
12
+ haystack-core = { package = "rusty-haystack-core", version = "0.3.2", path = "../haystack-core" }
12
13
  pyo3 = { version = "0.24", features = ["extension-module"] }
13
14
  chrono = "0.4"
@@ -0,0 +1,96 @@
1
+ # rusty-haystack
2
+
3
+ Fast Python bindings for [Project Haystack](https://project-haystack.org) powered by Rust.
4
+
5
+ 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.
6
+
7
+ ## Installation
8
+
9
+ ```sh
10
+ pip install rusty-haystack
11
+ ```
12
+
13
+ Requires Python 3.11+. Pre-built wheels are available for Linux and macOS (x86_64 and aarch64).
14
+
15
+ ## Quick Start
16
+
17
+ ```python
18
+ import rusty_haystack as rh
19
+
20
+ # Create an entity
21
+ entity = rh.HDict({
22
+ "id": rh.Ref("site-1", "Demo Site"),
23
+ "site": rh.Marker(),
24
+ "dis": "Demo Site",
25
+ "area": rh.Number(5000, "ft²"),
26
+ "geoCoord": rh.Coord(40.7128, -74.0060),
27
+ })
28
+
29
+ # Build a graph and query it
30
+ graph = rh.EntityGraph()
31
+ graph.add(entity)
32
+ results = graph.read("site")
33
+
34
+ # Encode/decode across formats
35
+ zinc_str = rh.encode_grid("text/zinc", results)
36
+ json_str = rh.encode_grid("application/json", results)
37
+ decoded = rh.decode_grid("text/zinc", zinc_str)
38
+
39
+ # Validate against the standard ontology
40
+ ns = rh.DefNamespace.load_standard()
41
+ issues = ns.validate_entity(entity)
42
+ ```
43
+
44
+ ## Features
45
+
46
+ - **Kind types** — Marker, NA, Remove, Number (with units), Ref, Uri, Symbol, XStr, Coord, HDateTime, HDict, HGrid, HList
47
+ - **Codecs** — Zinc, Trio, JSON, JSON v3, CSV encoding and decoding
48
+ - **Filters** — Parse and evaluate Haystack filter expressions against entities
49
+ - **EntityGraph** — In-memory graph with CRUD, filter queries, and ref traversal
50
+ - **Ontology** — DefNamespace with `is_a`, `fits`, `validate_entity`, subtype/supertype queries
51
+ - **Xeto** — Load/unload Xeto libraries, inspect specs and slots, export to Xeto source
52
+
53
+ ## Codecs
54
+
55
+ Supported MIME types: `"text/zinc"`, `"text/trio"`, `"application/json"`, `"application/json;v=3"`, `"text/csv"`.
56
+
57
+ ```python
58
+ # Grid encode/decode
59
+ zinc_str = rh.encode_grid("text/zinc", grid)
60
+ grid = rh.decode_grid("text/zinc", zinc_str)
61
+
62
+ # Scalar encode/decode
63
+ s = rh.encode_scalar("text/zinc", rh.Number(72.5, "°F"))
64
+ v = rh.decode_scalar("text/zinc", s)
65
+ ```
66
+
67
+ ## EntityGraph
68
+
69
+ ```python
70
+ graph = rh.EntityGraph()
71
+ graph.add(rh.HDict({"id": rh.Ref("site-1"), "site": rh.Marker(), "dis": "HQ"}))
72
+ graph.add(rh.HDict({"id": rh.Ref("ahu-1"), "equip": rh.Marker(), "siteRef": rh.Ref("site-1")}))
73
+
74
+ results = graph.read("equip") # filter query
75
+ graph.refs_from("ahu-1") # -> ["site-1"]
76
+ graph.refs_to("site-1") # -> ["ahu-1"]
77
+ ```
78
+
79
+ ## Ontology & Xeto
80
+
81
+ ```python
82
+ ns = rh.DefNamespace.load_standard()
83
+
84
+ ns.is_a("ahu", "equip") # True
85
+ ns.fits(entity, "site") # True
86
+ ns.subtypes("equip") # ["ahu", "vav", ...]
87
+ ns.validate_entity(entity) # list of issue strings
88
+
89
+ # Load custom Xeto libraries
90
+ ns.load_xeto(source_text, "myLib")
91
+ spec = ns.get_spec("myLib::MyType")
92
+ ```
93
+
94
+ ## License
95
+
96
+ MIT
@@ -1,17 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: rusty-haystack
3
- Version: 0.3.0
4
- Classifier: Programming Language :: Rust
5
- Classifier: Programming Language :: Python :: Implementation :: CPython
6
- Classifier: Programming Language :: Python :: 3.11
7
- Classifier: Programming Language :: Python :: 3.12
8
- Classifier: Programming Language :: Python :: 3.13
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Topic :: Software Development :: Libraries
11
- Summary: Python bindings for the Rusty Haystack Project Haystack implementation
12
- Keywords: haystack,iot,building-automation,smart-buildings
13
- Author-email: Justin Scott <jscott3201@gmail.com>
14
- License: MIT
15
- Requires-Python: >=3.11
16
- Project-URL: Homepage, https://github.com/justinscott/rusty-haystack
17
- Project-URL: Repository, https://github.com/justinscott/rusty-haystack