quantara 0.1.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.
quantara-0.1.2/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Abhijeet Rajhans
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,475 @@
1
+ Metadata-Version: 2.4
2
+ Name: quantara
3
+ Version: 0.1.2
4
+ Summary: A local-first vector database engine with pluggable indexes, collection management, metadata filtering, and vector similarity search.
5
+ Author: Abhijeet Rajhans
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/abhijeetrajhansgithub/quantara
8
+ Project-URL: Repository, https://github.com/abhijeetrajhansgithub/quantara
9
+ Project-URL: Issues, https://github.com/abhijeetrajhansgithub/quantara/issues
10
+ Keywords: vector-database,vector-search,similarity-search,embeddings,rag,retrieval-augmented-generation,database,local-database,ai,machine-learning
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Topic :: Database
15
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
16
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Programming Language :: Python :: 3
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: numpy>=1.21.2
28
+ Dynamic: license-file
29
+
30
+ # Quantara
31
+
32
+ A lightweight, local-first vector database built in pure Python with support for collections, metadata filtering, persistence, pluggable indexes, and custom index registration.
33
+
34
+ Quantara is designed for developers, researchers, and students who want a simple yet extensible vector database that runs entirely on their local machine without requiring external services.
35
+
36
+ ---
37
+
38
+ ## Features
39
+
40
+ ### Core Database
41
+
42
+ * Collection-based organization
43
+ * CRUD operations
44
+ * Batch document insertion
45
+ * Metadata support
46
+ * Metadata filtering during search
47
+ * Collection cloning
48
+ * Collection renaming
49
+ * Collection deletion
50
+ * Collection statistics
51
+
52
+ ### Vector Search
53
+
54
+ * Cosine Similarity
55
+ * Dot Product Similarity
56
+ * Euclidean Distance
57
+ * Top-K nearest neighbor search
58
+ * Configurable search metrics
59
+
60
+ ### Persistence
61
+
62
+ * Local `.db` storage
63
+ * Automatic persistence
64
+ * JSON import/export
65
+ * Database configuration persistence
66
+ * Index persistence and restoration
67
+
68
+ ### Indexing
69
+
70
+ * Pluggable indexing architecture
71
+ * Built-in Brute Force index
72
+ * Custom index registration API
73
+ * Collection-specific indexes
74
+ * Index save/load support
75
+
76
+ ### Developer Experience
77
+
78
+ * Type hints throughout the codebase
79
+ * Dataclass-based records
80
+ * Extensible architecture
81
+ * Local-first design
82
+ * No external database dependencies
83
+
84
+ ---
85
+
86
+ ## Installation
87
+
88
+ ```bash
89
+ pip install quantara
90
+ ```
91
+
92
+ Or install from source:
93
+
94
+ ```bash
95
+ git clone https://github.com/<your-username>/quantara.git
96
+
97
+ cd quantara
98
+
99
+ pip install -e .
100
+ ```
101
+
102
+ ---
103
+
104
+ ## Quick Start
105
+
106
+ ```python
107
+ import ollama
108
+
109
+ from quantara import Database
110
+
111
+ EMBEDDING_MODEL = "snowflake-arctic-embed:335m"
112
+
113
+ db = Database(
114
+ "my_database",
115
+ auto_persist=True
116
+ )
117
+
118
+ text = "I want to build AI agents."
119
+
120
+ embedding = ollama.embeddings(
121
+ model=EMBEDDING_MODEL,
122
+ prompt=text
123
+ )["embedding"]
124
+
125
+ db.insert_doc(
126
+ name=text,
127
+ vector=embedding,
128
+ metadata={
129
+ "category": "ai"
130
+ }
131
+ )
132
+
133
+ query = "How can I build autonomous AI systems?"
134
+
135
+ query_embedding = ollama.embeddings(
136
+ model=EMBEDDING_MODEL,
137
+ prompt=query
138
+ )["embedding"]
139
+
140
+ results = db.search_doc(
141
+ query_embedding,
142
+ top_k=3
143
+ )
144
+
145
+ print(results)
146
+ ```
147
+
148
+ ---
149
+
150
+ ## Collections
151
+
152
+ Create a collection:
153
+
154
+ ```python
155
+ db.create_collection(
156
+ "research"
157
+ )
158
+ ```
159
+
160
+ Insert into a collection:
161
+
162
+ ```python
163
+ db.insert_doc(
164
+ collection="research",
165
+ name="Transformers Paper",
166
+ vector=embedding,
167
+ metadata={
168
+ "author": "Vaswani"
169
+ }
170
+ )
171
+ ```
172
+
173
+ List collections:
174
+
175
+ ```python
176
+ db.list_collections()
177
+ ```
178
+
179
+ Rename a collection:
180
+
181
+ ```python
182
+ db.rename_collection(
183
+ "research",
184
+ "papers"
185
+ )
186
+ ```
187
+
188
+ Clone a collection:
189
+
190
+ ```python
191
+ db.clone_collection(
192
+ "papers",
193
+ "papers_backup"
194
+ )
195
+ ```
196
+
197
+ Delete a collection:
198
+
199
+ ```python
200
+ db.delete_collection(
201
+ "papers_backup"
202
+ )
203
+ ```
204
+
205
+ ---
206
+
207
+ ## Metadata Filtering
208
+
209
+ Search only documents matching specific metadata:
210
+
211
+ ```python
212
+ results = db.search_doc(
213
+ query_embedding,
214
+ collection="research",
215
+ filters={
216
+ "author": "Vaswani"
217
+ }
218
+ )
219
+ ```
220
+
221
+ ---
222
+
223
+ ## Batch Insertion
224
+
225
+ ```python
226
+ db.batch_insert_docs(
227
+ objects=[
228
+ (
229
+ "Document 1",
230
+ embedding_1,
231
+ {
232
+ "type": "paper"
233
+ }
234
+ ),
235
+ (
236
+ "Document 2",
237
+ embedding_2,
238
+ {
239
+ "type": "article"
240
+ }
241
+ )
242
+ ],
243
+ collection="research"
244
+ )
245
+ ```
246
+
247
+ ---
248
+
249
+ ## Similarity Metrics
250
+
251
+ Quantara supports multiple similarity metrics:
252
+
253
+ ```python
254
+ db.search_doc(
255
+ query_embedding,
256
+ metric="cosine"
257
+ )
258
+ ```
259
+
260
+ ```python
261
+ db.search_doc(
262
+ query_embedding,
263
+ metric="dot"
264
+ )
265
+ ```
266
+
267
+ ```python
268
+ db.search_doc(
269
+ query_embedding,
270
+ metric="euclidean"
271
+ )
272
+ ```
273
+
274
+ ---
275
+
276
+ ## Persistence
277
+
278
+ Persist database state:
279
+
280
+ ```python
281
+ db.persist_doc()
282
+ ```
283
+
284
+ Export database:
285
+
286
+ ```python
287
+ db.export_to_json(
288
+ "backup.json"
289
+ )
290
+ ```
291
+
292
+ Import database:
293
+
294
+ ```python
295
+ db.import_from_json(
296
+ "backup.json"
297
+ )
298
+ ```
299
+
300
+ ---
301
+
302
+ ## Indexes
303
+
304
+ ### Saving an Index
305
+
306
+ ```python
307
+ db.save_index(
308
+ collection="research",
309
+ path="research.index"
310
+ )
311
+ ```
312
+
313
+ ### Loading an Index
314
+
315
+ ```python
316
+ db = Database(
317
+ "my_database",
318
+ index_paths={
319
+ "research": "research.index"
320
+ }
321
+ )
322
+ ```
323
+
324
+ ---
325
+
326
+ ## Creating Custom Indexes
327
+
328
+ Quantara provides a pluggable indexing architecture.
329
+
330
+ Create a custom index:
331
+
332
+ ```python
333
+ from quantara import BaseIndex
334
+
335
+
336
+ class MyIndex(BaseIndex):
337
+
338
+ def build(self, vectors):
339
+ ...
340
+
341
+ def add(self, record_id, vector):
342
+ ...
343
+
344
+ def remove(self, record_id):
345
+ ...
346
+
347
+ def update(self, record_id, vector):
348
+ ...
349
+
350
+ def search(
351
+ self,
352
+ query_vector,
353
+ top_k=3,
354
+ **kwargs
355
+ ):
356
+ ...
357
+
358
+ def clear(self):
359
+ ...
360
+
361
+ def size(self):
362
+ ...
363
+
364
+ def save(self, path):
365
+ ...
366
+
367
+ def load(self, path):
368
+ ...
369
+ ```
370
+
371
+ Register the index:
372
+
373
+ ```python
374
+ from quantara import register_index
375
+
376
+ register_index(
377
+ "myindex",
378
+ MyIndex
379
+ )
380
+ ```
381
+
382
+ Use it in a collection:
383
+
384
+ ```python
385
+ db.create_collection(
386
+ "research",
387
+ index_type="myindex"
388
+ )
389
+ ```
390
+
391
+ ---
392
+
393
+ ## Statistics
394
+
395
+ Database statistics:
396
+
397
+ ```python
398
+ db.stats()
399
+ ```
400
+
401
+ Collection statistics:
402
+
403
+ ```python
404
+ db.collection_stats(
405
+ "research"
406
+ )
407
+ ```
408
+
409
+ ---
410
+
411
+ ## Architecture
412
+
413
+ ```text
414
+ Database
415
+
416
+ ├── Collections
417
+ │ ├── Records
418
+ │ └── Indexes
419
+
420
+ ├── Persistence Layer
421
+
422
+ ├── Metadata Layer
423
+
424
+ └── Search Layer
425
+ ```
426
+
427
+ ---
428
+
429
+ ## Project Goals
430
+
431
+ Quantara aims to provide:
432
+
433
+ * A lightweight local vector database
434
+ * A simple developer experience
435
+ * Extensible indexing support
436
+ * Fast experimentation for AI and RAG applications
437
+ * An educational implementation of vector database concepts
438
+
439
+ ---
440
+
441
+ ## Roadmap
442
+
443
+ ### Version 1.x
444
+
445
+ * Brute Force Index
446
+ * Metadata Filtering
447
+ * Collection Management
448
+ * Persistent Storage
449
+ * Custom Index Registration
450
+
451
+ ### Version 2.x
452
+
453
+ * HNSW Index
454
+ * Approximate Nearest Neighbor Search
455
+ * Additional Search Optimizations
456
+
457
+ ### Version 3.x
458
+
459
+ * Vector Quantization
460
+ * Compressed Vector Storage
461
+ * Advanced Indexing Strategies
462
+
463
+ ---
464
+
465
+ ## License
466
+
467
+ MIT License
468
+
469
+ ---
470
+
471
+ ## Author
472
+
473
+ Abhijeet Rajhans
474
+
475
+ Built as a learning-focused vector database project exploring vector search, indexing systems, persistence, and database architecture in Python.