kitedb 0.2.6__cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.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.
- kitedb/__init__.py +273 -0
- kitedb/_kitedb.cpython-312-aarch64-linux-gnu.so +0 -0
- kitedb/_kitedb.pyi +677 -0
- kitedb/builders.py +901 -0
- kitedb/fluent.py +850 -0
- kitedb/schema.py +327 -0
- kitedb/traversal.py +1523 -0
- kitedb/vector_index.py +472 -0
- kitedb-0.2.6.dist-info/METADATA +216 -0
- kitedb-0.2.6.dist-info/RECORD +12 -0
- kitedb-0.2.6.dist-info/WHEEL +5 -0
- kitedb-0.2.6.dist-info/licenses/LICENSE +21 -0
kitedb/__init__.py
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
"""
|
|
2
|
+
KiteDB - High-performance embedded graph database with vector search
|
|
3
|
+
|
|
4
|
+
A Python interface to the KiteDB graph database, providing:
|
|
5
|
+
- ACID transactions
|
|
6
|
+
- Node and edge CRUD operations
|
|
7
|
+
- Property storage
|
|
8
|
+
- Vector embeddings with IVF/IVF-PQ indexes
|
|
9
|
+
- Graph traversal and pathfinding (BFS, Dijkstra, A*)
|
|
10
|
+
|
|
11
|
+
Fluent API (Recommended):
|
|
12
|
+
>>> from kitedb import ray, node, edge, prop, optional
|
|
13
|
+
>>>
|
|
14
|
+
>>> # Define schema
|
|
15
|
+
>>> user = node("user",
|
|
16
|
+
... key=lambda id: f"user:{id}",
|
|
17
|
+
... props={
|
|
18
|
+
... "name": prop.string("name"),
|
|
19
|
+
... "email": prop.string("email"),
|
|
20
|
+
... "age": optional(prop.int("age")),
|
|
21
|
+
... }
|
|
22
|
+
... )
|
|
23
|
+
>>>
|
|
24
|
+
>>> knows = edge("knows", {"since": prop.int("since")})
|
|
25
|
+
>>>
|
|
26
|
+
>>> # Open database and use fluent API
|
|
27
|
+
>>> with ray("./my-graph", nodes=[user], edges=[knows]) as db:
|
|
28
|
+
... alice = db.insert(user).values(
|
|
29
|
+
... key="alice", name="Alice", email="alice@example.com", age=30
|
|
30
|
+
... ).returning()
|
|
31
|
+
...
|
|
32
|
+
... bob = db.insert(user).values(
|
|
33
|
+
... key="bob", name="Bob", email="bob@example.com", age=25
|
|
34
|
+
... ).returning()
|
|
35
|
+
...
|
|
36
|
+
... db.link(alice, knows, bob, since=2020)
|
|
37
|
+
...
|
|
38
|
+
... friends = db.from_(alice).out(knows).nodes().to_list()
|
|
39
|
+
... print([f.key for f in friends]) # ['user:bob']
|
|
40
|
+
|
|
41
|
+
Low-level API (for advanced use):
|
|
42
|
+
>>> from kitedb import Database, PropValue
|
|
43
|
+
>>>
|
|
44
|
+
>>> with Database("my_graph.kitedb") as db:
|
|
45
|
+
... db.begin()
|
|
46
|
+
... alice = db.create_node("user:alice")
|
|
47
|
+
... name_key = db.get_or_create_propkey("name")
|
|
48
|
+
... db.set_node_prop(alice, name_key, PropValue.string("Alice"))
|
|
49
|
+
... db.commit()
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
from kitedb._kitedb import (
|
|
53
|
+
# Core classes
|
|
54
|
+
Database,
|
|
55
|
+
OpenOptions,
|
|
56
|
+
SyncMode,
|
|
57
|
+
DbStats,
|
|
58
|
+
CheckResult,
|
|
59
|
+
CacheStats,
|
|
60
|
+
ExportOptions,
|
|
61
|
+
ImportOptions,
|
|
62
|
+
ExportResult,
|
|
63
|
+
ImportResult,
|
|
64
|
+
StreamOptions,
|
|
65
|
+
PaginationOptions,
|
|
66
|
+
NodeWithProps,
|
|
67
|
+
EdgeWithProps,
|
|
68
|
+
NodePage,
|
|
69
|
+
EdgePage,
|
|
70
|
+
CacheLayerMetrics,
|
|
71
|
+
CacheMetrics,
|
|
72
|
+
DataMetrics,
|
|
73
|
+
MvccMetrics,
|
|
74
|
+
MemoryMetrics,
|
|
75
|
+
DatabaseMetrics,
|
|
76
|
+
HealthCheckEntry,
|
|
77
|
+
HealthCheckResult,
|
|
78
|
+
BackupOptions,
|
|
79
|
+
RestoreOptions,
|
|
80
|
+
OfflineBackupOptions,
|
|
81
|
+
BackupResult,
|
|
82
|
+
PropValue,
|
|
83
|
+
Edge,
|
|
84
|
+
FullEdge,
|
|
85
|
+
NodeProp,
|
|
86
|
+
|
|
87
|
+
# Traversal result classes
|
|
88
|
+
TraversalResult as LowLevelTraversalResult,
|
|
89
|
+
PathResult as LowLevelPathResult,
|
|
90
|
+
PathEdge,
|
|
91
|
+
|
|
92
|
+
# Vector search classes
|
|
93
|
+
IvfIndex,
|
|
94
|
+
IvfPqIndex,
|
|
95
|
+
IvfConfig,
|
|
96
|
+
PqConfig,
|
|
97
|
+
SearchOptions,
|
|
98
|
+
SearchResult,
|
|
99
|
+
IvfStats,
|
|
100
|
+
|
|
101
|
+
# Functions
|
|
102
|
+
open_database,
|
|
103
|
+
collect_metrics,
|
|
104
|
+
health_check,
|
|
105
|
+
create_backup,
|
|
106
|
+
restore_backup,
|
|
107
|
+
get_backup_info,
|
|
108
|
+
create_offline_backup,
|
|
109
|
+
version,
|
|
110
|
+
brute_force_search,
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
# Fluent API imports
|
|
114
|
+
from kitedb.schema import (
|
|
115
|
+
prop,
|
|
116
|
+
PropDef,
|
|
117
|
+
PropBuilder,
|
|
118
|
+
optional,
|
|
119
|
+
NodeDef,
|
|
120
|
+
node,
|
|
121
|
+
define_node, # backwards compat
|
|
122
|
+
EdgeDef,
|
|
123
|
+
edge,
|
|
124
|
+
define_edge, # backwards compat
|
|
125
|
+
PropsSchema,
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
from kitedb.builders import (
|
|
129
|
+
NodeRef,
|
|
130
|
+
InsertBuilder,
|
|
131
|
+
UpdateBuilder,
|
|
132
|
+
DeleteBuilder,
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
from kitedb.traversal import (
|
|
136
|
+
EdgeResult,
|
|
137
|
+
EdgeTraversalResult,
|
|
138
|
+
RawEdge,
|
|
139
|
+
TraverseOptions,
|
|
140
|
+
TraversalBuilder,
|
|
141
|
+
TraversalResult,
|
|
142
|
+
PathFindingBuilder,
|
|
143
|
+
PathResult,
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
from kitedb.fluent import (
|
|
147
|
+
EdgeData,
|
|
148
|
+
Ray,
|
|
149
|
+
ray,
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
from kitedb.vector_index import (
|
|
153
|
+
VectorIndex,
|
|
154
|
+
VectorIndexOptions,
|
|
155
|
+
SimilarOptions,
|
|
156
|
+
VectorSearchHit,
|
|
157
|
+
create_vector_index,
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
__version__ = version()
|
|
161
|
+
|
|
162
|
+
__all__ = [
|
|
163
|
+
# ==========================================================================
|
|
164
|
+
# Fluent API (Recommended)
|
|
165
|
+
# ==========================================================================
|
|
166
|
+
|
|
167
|
+
# Entry point
|
|
168
|
+
"ray",
|
|
169
|
+
"Ray",
|
|
170
|
+
"EdgeData",
|
|
171
|
+
"VectorIndex",
|
|
172
|
+
"VectorIndexOptions",
|
|
173
|
+
"SimilarOptions",
|
|
174
|
+
"VectorSearchHit",
|
|
175
|
+
"create_vector_index",
|
|
176
|
+
|
|
177
|
+
# Schema builders
|
|
178
|
+
"node",
|
|
179
|
+
"edge",
|
|
180
|
+
"define_node", # backwards compat alias
|
|
181
|
+
"define_edge", # backwards compat alias
|
|
182
|
+
"prop",
|
|
183
|
+
"optional",
|
|
184
|
+
"PropDef",
|
|
185
|
+
"PropBuilder",
|
|
186
|
+
"NodeDef",
|
|
187
|
+
"EdgeDef",
|
|
188
|
+
"PropsSchema",
|
|
189
|
+
|
|
190
|
+
# Node and edge references
|
|
191
|
+
"NodeRef",
|
|
192
|
+
|
|
193
|
+
# Builders
|
|
194
|
+
"InsertBuilder",
|
|
195
|
+
"UpdateBuilder",
|
|
196
|
+
"DeleteBuilder",
|
|
197
|
+
|
|
198
|
+
# Traversal
|
|
199
|
+
"TraversalBuilder",
|
|
200
|
+
"TraversalResult",
|
|
201
|
+
"EdgeTraversalResult",
|
|
202
|
+
"EdgeResult",
|
|
203
|
+
"RawEdge",
|
|
204
|
+
"TraverseOptions",
|
|
205
|
+
"PathFindingBuilder",
|
|
206
|
+
"PathResult",
|
|
207
|
+
|
|
208
|
+
# ==========================================================================
|
|
209
|
+
# Low-level API
|
|
210
|
+
# ==========================================================================
|
|
211
|
+
|
|
212
|
+
# Core
|
|
213
|
+
"Database",
|
|
214
|
+
"OpenOptions",
|
|
215
|
+
"SyncMode",
|
|
216
|
+
"DbStats",
|
|
217
|
+
"CheckResult",
|
|
218
|
+
"CacheStats",
|
|
219
|
+
"ExportOptions",
|
|
220
|
+
"ImportOptions",
|
|
221
|
+
"ExportResult",
|
|
222
|
+
"ImportResult",
|
|
223
|
+
"StreamOptions",
|
|
224
|
+
"PaginationOptions",
|
|
225
|
+
"NodeWithProps",
|
|
226
|
+
"EdgeWithProps",
|
|
227
|
+
"NodePage",
|
|
228
|
+
"EdgePage",
|
|
229
|
+
"CacheLayerMetrics",
|
|
230
|
+
"CacheMetrics",
|
|
231
|
+
"DataMetrics",
|
|
232
|
+
"MvccMetrics",
|
|
233
|
+
"MemoryMetrics",
|
|
234
|
+
"DatabaseMetrics",
|
|
235
|
+
"HealthCheckEntry",
|
|
236
|
+
"HealthCheckResult",
|
|
237
|
+
"BackupOptions",
|
|
238
|
+
"RestoreOptions",
|
|
239
|
+
"OfflineBackupOptions",
|
|
240
|
+
"BackupResult",
|
|
241
|
+
"PropValue",
|
|
242
|
+
"Edge",
|
|
243
|
+
"FullEdge",
|
|
244
|
+
"NodeProp",
|
|
245
|
+
|
|
246
|
+
# Traversal (low-level)
|
|
247
|
+
"LowLevelTraversalResult",
|
|
248
|
+
"LowLevelPathResult",
|
|
249
|
+
"PathEdge",
|
|
250
|
+
|
|
251
|
+
# Vector
|
|
252
|
+
"IvfIndex",
|
|
253
|
+
"IvfPqIndex",
|
|
254
|
+
"IvfConfig",
|
|
255
|
+
"PqConfig",
|
|
256
|
+
"SearchOptions",
|
|
257
|
+
"SearchResult",
|
|
258
|
+
"IvfStats",
|
|
259
|
+
|
|
260
|
+
# Functions
|
|
261
|
+
"open_database",
|
|
262
|
+
"collect_metrics",
|
|
263
|
+
"health_check",
|
|
264
|
+
"create_backup",
|
|
265
|
+
"restore_backup",
|
|
266
|
+
"get_backup_info",
|
|
267
|
+
"create_offline_backup",
|
|
268
|
+
"version",
|
|
269
|
+
"brute_force_search",
|
|
270
|
+
|
|
271
|
+
# Version
|
|
272
|
+
"__version__",
|
|
273
|
+
]
|
|
Binary file
|