querygraph 0.2.0__py3-none-any.whl
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.
- querygraph/__init__.py +14 -0
- querygraph/__main__.py +4 -0
- querygraph/agents.py +89 -0
- querygraph/base58.py +15 -0
- querygraph/cdif.py +205 -0
- querygraph/cli.py +123 -0
- querygraph/codata.py +38 -0
- querygraph/croissant.py +86 -0
- querygraph/dataverse.py +155 -0
- querygraph/did.py +51 -0
- querygraph/lakehouse.py +115 -0
- querygraph/lineage.py +106 -0
- querygraph/navigator.py +141 -0
- querygraph/odrl.py +60 -0
- querygraph/odrl_rights.py +50 -0
- querygraph/osi.py +155 -0
- querygraph/qglake.py +99 -0
- querygraph/rbac.py +31 -0
- querygraph/typedid.py +211 -0
- querygraph/validation.py +41 -0
- querygraph-0.2.0.dist-info/METADATA +172 -0
- querygraph-0.2.0.dist-info/RECORD +24 -0
- querygraph-0.2.0.dist-info/WHEEL +4 -0
- querygraph-0.2.0.dist-info/entry_points.txt +2 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: querygraph
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Python port of the QueryGraph AI Navigator semantic layer
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
Requires-Dist: pydantic>=2.7
|
|
8
|
+
Provides-Extra: agents
|
|
9
|
+
Requires-Dist: langchain-core>=0.3; extra == 'agents'
|
|
10
|
+
Provides-Extra: all
|
|
11
|
+
Requires-Dist: googleapis-common-protos>=1.75.0; extra == 'all'
|
|
12
|
+
Requires-Dist: grpcio-status>=1.81.0; extra == 'all'
|
|
13
|
+
Requires-Dist: grpcio>=1.81.0; extra == 'all'
|
|
14
|
+
Requires-Dist: langchain-core>=0.3; extra == 'all'
|
|
15
|
+
Requires-Dist: pandas>=3.0.0; extra == 'all'
|
|
16
|
+
Requires-Dist: pyarrow>=24.0.0; extra == 'all'
|
|
17
|
+
Requires-Dist: pyspark>=4.1.2; extra == 'all'
|
|
18
|
+
Requires-Dist: zstandard>=0.25.0; extra == 'all'
|
|
19
|
+
Provides-Extra: lakehouse
|
|
20
|
+
Requires-Dist: googleapis-common-protos>=1.75.0; extra == 'lakehouse'
|
|
21
|
+
Requires-Dist: grpcio-status>=1.81.0; extra == 'lakehouse'
|
|
22
|
+
Requires-Dist: grpcio>=1.81.0; extra == 'lakehouse'
|
|
23
|
+
Requires-Dist: pandas>=3.0.0; extra == 'lakehouse'
|
|
24
|
+
Requires-Dist: pyarrow>=24.0.0; extra == 'lakehouse'
|
|
25
|
+
Requires-Dist: pyspark>=4.1.2; extra == 'lakehouse'
|
|
26
|
+
Requires-Dist: zstandard>=0.25.0; extra == 'lakehouse'
|
|
27
|
+
Provides-Extra: test
|
|
28
|
+
Requires-Dist: pytest>=8.0; extra == 'test'
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# QueryGraph Python
|
|
32
|
+
|
|
33
|
+
Python ecosystem for the QueryGraph AI Navigator.
|
|
34
|
+
|
|
35
|
+
It mirrors and extends the Rust implementation in `../qg-rust`:
|
|
36
|
+
|
|
37
|
+
- Croissant JSON-LD dataset metadata
|
|
38
|
+
- CDIF discovery/access/profile projection
|
|
39
|
+
- deterministic `did:oyd` identity documents
|
|
40
|
+
- ODRL permissions and prohibitions
|
|
41
|
+
- OSI semantic models over Croissant fields and Sail columns
|
|
42
|
+
- TypeDID agents modeled with Pydantic
|
|
43
|
+
- optional LangChain adapters for governed agent tools
|
|
44
|
+
- OpenLineage events and DID-style attestations
|
|
45
|
+
- PySpark helpers for querying a local Sail warehouse
|
|
46
|
+
- a CLI compatible with the Rust semantic bundle commands
|
|
47
|
+
|
|
48
|
+
The design goal is Python-native ergonomics over the same governed lakehouse:
|
|
49
|
+
Rust loads and verifies the warehouse; Python gives notebooks, PySpark users,
|
|
50
|
+
LangChain agents, and data scientists a typed interop layer.
|
|
51
|
+
|
|
52
|
+
## Stack versions
|
|
53
|
+
|
|
54
|
+
This port tracks the same coordinated QueryGraph stack releases as `../qg-rust`:
|
|
55
|
+
|
|
56
|
+
- **Grust 0.11.0 "Crab"** — the property-graph + GQL/Cypher substrate.
|
|
57
|
+
- **TypeSec 0.11.0 "Burano"** — the typed security fabric; the Pydantic
|
|
58
|
+
`TypeDidEnvelope` mirrors its audit-safe attestation (action, resource,
|
|
59
|
+
privacy level, negotiated profile, and an envelope digest).
|
|
60
|
+
- **LakeCat 0.2.1 "Lynx"** — the thin Iceberg REST catalog boundary, now sharing
|
|
61
|
+
its bootstrap-bundle wire format with the importer via `qglake-bundle`.
|
|
62
|
+
|
|
63
|
+
See `../qg-rust/docs/blog/announcing-querygraph-stack.md` for the full story.
|
|
64
|
+
|
|
65
|
+
## Install
|
|
66
|
+
|
|
67
|
+
Core metadata and TypeDID/Pydantic support:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
uv sync
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Optional PySpark/Sail support:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
uv sync --extra lakehouse
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Optional LangChain tool adapters:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
uv sync --extra agents
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Everything:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
uv sync --extra all
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Build a Semantic Bundle
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
python -m querygraph navigator \
|
|
95
|
+
--dataset-name "Hazard vocabulary" \
|
|
96
|
+
--description "Controlled vocabulary with multilingual technical terms" \
|
|
97
|
+
--landing-page "https://querygraph.ai/datasets/hazards" \
|
|
98
|
+
--data-url "https://querygraph.ai/datasets/hazards.csv"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## QG Lakehouse Agent Story
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
python -m querygraph qglake-story --pretty
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
This produces a Pydantic TypeDID multi-agent run: supervisor, finance, energy,
|
|
108
|
+
mobility, climate-health, reference, restricted-data broker, synthesis,
|
|
109
|
+
OpenLineage, and DID attestation.
|
|
110
|
+
|
|
111
|
+
## Query Sail with PySpark
|
|
112
|
+
|
|
113
|
+
Start Sail from the Rust project after the lakehouse has been loaded:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
cd ../qg-rust
|
|
117
|
+
sail spark server --port 50051
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
In another shell:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
cd ../qg-python
|
|
124
|
+
uv sync --extra lakehouse
|
|
125
|
+
uv run querygraph lakehouse-register \
|
|
126
|
+
--manifest ../qg-rust/.querygraph/lakehouse/manifest/load-report.json \
|
|
127
|
+
--warehouse ../qg-rust/spark-warehouse
|
|
128
|
+
uv run querygraph audit-register --warehouse ../qg-rust/spark-warehouse
|
|
129
|
+
uv run querygraph pyspark-examples
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Open a shell:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
uv run pyspark --remote sc://127.0.0.1:50051
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Then query the registered views:
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
spark.sql("SELECT COUNT(*) FROM global_temp.government_finance__countydata").show()
|
|
142
|
+
spark.sql("SELECT quantity, value, unit FROM global_temp.codata_constants_2022__codata_constants_2022 LIMIT 5").show(truncate=False)
|
|
143
|
+
spark.sql("SELECT event_hash, event_type, job_name FROM global_temp.openlineage_events LIMIT 10").show(truncate=False)
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## OSI with Semantic Croissant
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
uv run python examples/osi_semantic_croissant.py
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
The example starts with concrete Semantic Croissant fields and projects them
|
|
153
|
+
into an OSI semantic model with ontology terms and Sail SQL expressions.
|
|
154
|
+
|
|
155
|
+
## TypeDID Agents with LangChain
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
uv sync --extra agents
|
|
159
|
+
uv run python examples/typedid_langchain_agents.py
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
The agents are Pydantic models first. When LangChain is installed, a
|
|
163
|
+
`TypeDidLangChainToolAdapter` exposes the same governed agent as a LangChain
|
|
164
|
+
`StructuredTool`.
|
|
165
|
+
|
|
166
|
+
## Test
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
uv run python -m pytest
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
The test suite includes equivalence checks against the sibling Rust implementation.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
querygraph/__init__.py,sha256=84T6TBw-7VgYjrtu5GIpyvnVVgMQxsoHSs2uL4U4OS0,393
|
|
2
|
+
querygraph/__main__.py,sha256=rMIka4mhgI9ghOEiIXc05n5EGGxE7AKqOr8s07dN1Os,89
|
|
3
|
+
querygraph/agents.py,sha256=ewYV5NvAYtnp_mk4Agu4HVsgfenm2IAogfS-qgArURE,3023
|
|
4
|
+
querygraph/base58.py,sha256=uPZF1kdidqZPuP38SwUY-Bbc8nyRmuiEuWSOHEkanHc,412
|
|
5
|
+
querygraph/cdif.py,sha256=wKK7Vr21TUEBrqWiVra5L4z7paxB7HgrwA74T78h-Ik,7345
|
|
6
|
+
querygraph/cli.py,sha256=hGHDoJPHmSIE9YEiP9CBYV9PMaTyUYLbrkjDea3rEVQ,4643
|
|
7
|
+
querygraph/codata.py,sha256=JbRQe0pQeRyddpXMNHPxvT3bR15RzbjMtJsq5wMUvew,1099
|
|
8
|
+
querygraph/croissant.py,sha256=wNMBMBqgOwwe7e9WALqsfqm1_A34c_cr7Snp123u0N8,2493
|
|
9
|
+
querygraph/dataverse.py,sha256=U34gRUr9a2CIou3B679HPBmhBq8_MsEzjEQ2uSc9hN4,5773
|
|
10
|
+
querygraph/did.py,sha256=CdQ0zwmKqpWsPpspMoDmj308MehGAPMKeTEjyKhBlbc,1590
|
|
11
|
+
querygraph/lakehouse.py,sha256=jIMgzmzHLZCnXgTESJxQaU0H5tUG-2HN9eh32isY5T4,3989
|
|
12
|
+
querygraph/lineage.py,sha256=IoBIklVKdnBdCOb4Y7WzOVHroS7VzcFXnM_DJcZZdeI,3641
|
|
13
|
+
querygraph/navigator.py,sha256=lhbqY5y02TVCqJOiIQPpLTV2hE9UpWF3gN2sM_fEicI,4760
|
|
14
|
+
querygraph/odrl.py,sha256=1HI_FL_KIvW59ebsqSM12BD8boIh3g5CCaS4aE3cM04,1503
|
|
15
|
+
querygraph/odrl_rights.py,sha256=cpigthm99OYM7bqhTqnszlwjAthwN2PdgTwx5w-lt6o,1429
|
|
16
|
+
querygraph/osi.py,sha256=hbhVo7eKm2KhHBGcnT374KRwPBcL3xMdPzVZVwbeE0o,4971
|
|
17
|
+
querygraph/qglake.py,sha256=NFkaC4j-upebP_CxfcIixUIRXy0fcBUiC04M3Qs4lgw,4017
|
|
18
|
+
querygraph/rbac.py,sha256=RN8oPFB6FqWv2LOrZXz6BzwuPNA-QKuggvPE9Fs1NhU,839
|
|
19
|
+
querygraph/typedid.py,sha256=Ll8dz2BYF5wXzDnN9MsUAPfsv4Szv55hyoTETqHbT1Q,6251
|
|
20
|
+
querygraph/validation.py,sha256=F8YNd7vYxr4BnNprHeJZD3wYzjBLNRNvCiZBPsh3GB0,1368
|
|
21
|
+
querygraph-0.2.0.dist-info/METADATA,sha256=mLsvhHhec0Myh9L6LqhiAdbvk8vweX5aWui_x2lMZj8,5128
|
|
22
|
+
querygraph-0.2.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
|
|
23
|
+
querygraph-0.2.0.dist-info/entry_points.txt,sha256=AwnTT2bQoVTxAq7Aw4fbOayWzSDXB7d-PGuzTWgbQB0,51
|
|
24
|
+
querygraph-0.2.0.dist-info/RECORD,,
|