beaver-db 0.17.5__py3-none-any.whl → 0.17.6__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.
Potentially problematic release.
This version of beaver-db might be problematic. Click here for more details.
- {beaver_db-0.17.5.dist-info → beaver_db-0.17.6.dist-info}/METADATA +86 -28
- {beaver_db-0.17.5.dist-info → beaver_db-0.17.6.dist-info}/RECORD +5 -5
- {beaver_db-0.17.5.dist-info → beaver_db-0.17.6.dist-info}/WHEEL +0 -0
- {beaver_db-0.17.5.dist-info → beaver_db-0.17.6.dist-info}/entry_points.txt +0 -0
- {beaver_db-0.17.5.dist-info → beaver_db-0.17.6.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: beaver-db
|
|
3
|
-
Version: 0.17.
|
|
3
|
+
Version: 0.17.6
|
|
4
4
|
Summary: Fast, embedded, and multi-modal DB based on SQLite for AI-powered applications.
|
|
5
5
|
License-File: LICENSE
|
|
6
6
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -42,7 +42,7 @@ A fast, single-file, multi-modal database for Python, built with the standard `s
|
|
|
42
42
|
|
|
43
43
|
`beaver` is built with a minimalistic philosophy for small, local use cases where a full-blown database server would be overkill.
|
|
44
44
|
|
|
45
|
-
- **Minimalistic**: The core library has zero external dependencies. Vector search
|
|
45
|
+
- **Minimalistic**: The core library has zero external dependencies. Vector search, the REST server, and the CLI, which require external libraries, are available as optional features.
|
|
46
46
|
- **Schemaless**: Flexible data storage without rigid schemas across all modalities.
|
|
47
47
|
- **Synchronous, Multi-Process, and Thread-Safe**: Designed for simplicity and safety in multi-threaded and multi-process environments.
|
|
48
48
|
- **Built for Local Applications**: Perfect for local AI tools, RAG prototypes, chatbots, and desktop utilities that need persistent, structured data without network overhead.
|
|
@@ -61,6 +61,8 @@ A fast, single-file, multi-modal database for Python, built with the standard `s
|
|
|
61
61
|
- **Full-Text and Fuzzy Search**: Automatically index and search through document metadata using SQLite's powerful FTS5 engine, enhanced with optional fuzzy search for typo-tolerant matching.
|
|
62
62
|
- **Knowledge Graph**: Create relationships between documents and traverse the graph to find neighbors or perform multi-hop walks.
|
|
63
63
|
- **Single-File & Portable**: All data is stored in a single SQLite file, making it incredibly easy to move, back up, or embed in your application.
|
|
64
|
+
- **Built-in REST API Server (Optional)**: Instantly serve your database over a RESTful API with automatic OpenAPI documentation using FastAPI.
|
|
65
|
+
- **Full-Featured CLI Client (Optional)**: Interact with your database directly from the command line for administrative tasks and data exploration.
|
|
64
66
|
- **Optional Type-Safety:** Although the database is schemaless, you can use a minimalistic typing system for automatic serialization and deserialization that is Pydantic-compatible out of the box.
|
|
65
67
|
|
|
66
68
|
## How Beaver is Implemented
|
|
@@ -79,7 +81,6 @@ The vector store in BeaverDB is designed for high performance and reliability, u
|
|
|
79
81
|
|
|
80
82
|
This hybrid approach allows BeaverDB to provide a vector search experience that is both fast and durable, without sacrificing the single-file, embedded philosophy of the library.
|
|
81
83
|
|
|
82
|
-
|
|
83
84
|
## Installation
|
|
84
85
|
|
|
85
86
|
Install the core, dependency-free library:
|
|
@@ -88,10 +89,17 @@ Install the core, dependency-free library:
|
|
|
88
89
|
pip install beaver-db
|
|
89
90
|
```
|
|
90
91
|
|
|
91
|
-
|
|
92
|
+
To include optional features, you can install them as extras:
|
|
92
93
|
|
|
93
94
|
```bash
|
|
95
|
+
# For vector search capabilities
|
|
94
96
|
pip install "beaver-db[faiss]"
|
|
97
|
+
|
|
98
|
+
# For the REST API server and CLI
|
|
99
|
+
pip install "beaver-db[server,cli]"
|
|
100
|
+
|
|
101
|
+
# To install all optional features at once
|
|
102
|
+
pip install "beaver-db[full]"
|
|
95
103
|
```
|
|
96
104
|
|
|
97
105
|
## Quickstart
|
|
@@ -131,6 +139,53 @@ print(f"FTS Result: '{top_doc.content}'")
|
|
|
131
139
|
db.close()
|
|
132
140
|
```
|
|
133
141
|
|
|
142
|
+
## Built-in Server and CLI
|
|
143
|
+
|
|
144
|
+
Beaver comes with a built-in REST API server and a full-featured command-line client, allowing you to interact with your database without writing any code.
|
|
145
|
+
|
|
146
|
+
### REST API Server
|
|
147
|
+
|
|
148
|
+
You can instantly expose all of your database's functionality over a RESTful API. This is perfect for building quick prototypes, microservices, or for interacting with your data from other languages.
|
|
149
|
+
|
|
150
|
+
**1. Start the server**
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Start the server for your database file
|
|
154
|
+
beaver serve --database data.db --port 8000
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
This starts a `FastAPI` server. You can now access the interactive API documentation at `http://127.0.0.1:8000/docs`.
|
|
158
|
+
|
|
159
|
+
**2. Interact with the API**
|
|
160
|
+
|
|
161
|
+
Here are a couple of examples using `curl`:
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# Set a value in the 'app_config' dictionary
|
|
165
|
+
curl -X PUT http://127.0.0.1:8000/dicts/app_config/api_key
|
|
166
|
+
-H "Content-Type: application/json"
|
|
167
|
+
-d '"your-secret-api-key"'
|
|
168
|
+
|
|
169
|
+
# Get the value back
|
|
170
|
+
curl http://127.0.0.1:8000/dicts/app_config/api_key
|
|
171
|
+
# Output: "your-secret-api-key"
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Command-Line Client
|
|
175
|
+
|
|
176
|
+
The CLI client allows you to call any BeaverDB method directly from your terminal.
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Set a value in a dictionary
|
|
180
|
+
beaver client --database data.db dict app_config set theme light
|
|
181
|
+
|
|
182
|
+
# Get the value back
|
|
183
|
+
beaver client --database data.db dict app_config get theme
|
|
184
|
+
|
|
185
|
+
# Push an item to a list
|
|
186
|
+
beaver client --database data.db list daily_tasks push "Review PRs"
|
|
187
|
+
```
|
|
188
|
+
|
|
134
189
|
## Things You Can Build with Beaver
|
|
135
190
|
|
|
136
191
|
Here are a few ideas to inspire your next project, showcasing how to combine Beaver's features to build powerful local applications.
|
|
@@ -282,8 +337,10 @@ For enhanced data integrity and a better developer experience, BeaverDB supports
|
|
|
282
337
|
|
|
283
338
|
This feature is designed to be flexible and works seamlessly with two kinds of models:
|
|
284
339
|
|
|
285
|
-
|
|
286
|
-
|
|
340
|
+
- **Pydantic Models**: If you're already using Pydantic, your `BaseModel` classes will work out of the box.
|
|
341
|
+
|
|
342
|
+
- **Lightweight `beaver.Model`**: For a zero-dependency solution, you can inherit from the built-in `beaver.Model` class, which is a standard Python class with serialization methods automatically included.
|
|
343
|
+
|
|
287
344
|
|
|
288
345
|
Here’s a quick example of how to use it:
|
|
289
346
|
|
|
@@ -305,7 +362,8 @@ users["alice"] = User(name="Alice", email="alice@example.com")
|
|
|
305
362
|
|
|
306
363
|
# The retrieved object is a proper instance of the User class
|
|
307
364
|
retrieved_user = users["alice"]
|
|
308
|
-
|
|
365
|
+
# Your editor will provide autocompletion here
|
|
366
|
+
print(f"Retrieved: {retrieved_user.name}")
|
|
309
367
|
```
|
|
310
368
|
|
|
311
369
|
In the same way you can have typed message payloads in `db.channel`, typed metadata in `db.blobs`, and custom document types in `db.collection`, as well as custom types in lists and queues.
|
|
@@ -316,25 +374,25 @@ Basically everywhere you can store or get some object in BeaverDB, you can use a
|
|
|
316
374
|
|
|
317
375
|
For more in-depth examples, check out the scripts in the `examples/` directory:
|
|
318
376
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
377
|
+
- [`async_pubsub.py`](examples/async_pubsub.py): A demonstration of the asynchronous wrapper for the publish/subscribe system.
|
|
378
|
+
- [`blobs.py`](examples/blobs.py): Demonstrates how to store and retrieve binary data in the database.
|
|
379
|
+
- [`cache.py`](examples/cache.py): A practical example of using a dictionary with TTL as a cache for API calls.
|
|
380
|
+
- [`fts.py`](examples/fts.py): A detailed look at full-text search, including targeted searches on specific metadata fields.
|
|
381
|
+
- [`fuzzy.py`](examples/fuzzy.py): Demonstrates fuzzy search capabilities for text search.
|
|
382
|
+
- [`general_test.py`](examples/general_test.py): A general-purpose test to run all operations randomly which allows testing long-running processes and synchronicity issues.
|
|
383
|
+
- [`graph.py`](examples/graph.py): Shows how to create relationships between documents and perform multi-hop graph traversals.
|
|
384
|
+
- [`kvstore.py`](examples/kvstore.py): A comprehensive demo of the namespaced dictionary feature.
|
|
385
|
+
- [`list.py`](examples/list.py): Shows the full capabilities of the persistent list, including slicing and in-place updates.
|
|
386
|
+
- [`logs.py`](examples/logs.py): A short example showing how to build a realtime dashboard with the logging feature.
|
|
387
|
+
- [`pqueue.py`](examples/pqueue.py): A practical example of using the persistent priority queue for task management.
|
|
388
|
+
- [`producer_consumer.py`](examples/producer_consumer.py): A demonstration of the distributed task queue system in a multi-process environment.
|
|
389
|
+
- [`publisher.py`](examples/publisher.p) and [`subscriber.py`](examples/subscriber.py): A pair of examples demonstrating inter-process message passing with the publish/subscribe system.
|
|
390
|
+
- [`pubsub.py`](examples/pubsub.py): A demonstration of the synchronous, thread-safe publish/subscribe system in a single process.
|
|
391
|
+
- [`rerank.py`](examples/rerank.py): Shows how to combine results from vector and text search for more refined results.
|
|
392
|
+
- [`stress_vectors.py`](examples/stress_vectors.py): A stress test for the vector search functionality.
|
|
393
|
+
- [`textual_chat.py`](examples/textual_chat.py): A chat application built with `textual` and `beaver` to illustrate the use of several primitives (lists, dicts, and channels) at the same time.
|
|
394
|
+
- [`type_hints.py`](examples/type_hints.py): Shows how to use type hints with `beaver` to get better IDE support and type safety.
|
|
395
|
+
- [`vector.py`](examples/vector.py): Demonstrates how to index and search vector embeddings, including upserts.
|
|
338
396
|
|
|
339
397
|
## Roadmap
|
|
340
398
|
|
|
@@ -342,7 +400,7 @@ For more in-depth examples, check out the scripts in the `examples/` directory:
|
|
|
342
400
|
|
|
343
401
|
These are some of the features and improvements planned for future releases:
|
|
344
402
|
|
|
345
|
-
|
|
403
|
+
- **Async API**: Extend the async support with on-demand wrappers for all features besides channels.
|
|
346
404
|
|
|
347
405
|
Check out the [roadmap](roadmap.md) for a detailed list of upcoming features and design ideas.
|
|
348
406
|
|
|
@@ -350,4 +408,4 @@ If you think of something that would make `beaver` more useful for your use case
|
|
|
350
408
|
|
|
351
409
|
## License
|
|
352
410
|
|
|
353
|
-
This project is licensed under the MIT License.
|
|
411
|
+
This project is licensed under the MIT License.
|
|
@@ -11,8 +11,8 @@ beaver/queues.py,sha256=Fr3oie63EtceSoiC8EOEDSLu1tDI8q2MYLXd8MEeC3g,6476
|
|
|
11
11
|
beaver/server.py,sha256=OixUvPTIbSYN3anPc98UiF2mM289yjJBQGla1S_HmIY,13556
|
|
12
12
|
beaver/types.py,sha256=WZLINf7hy6zdKdAFQK0EVMSl5vnY_KnrHXNdXgAKuPg,1582
|
|
13
13
|
beaver/vectors.py,sha256=qvI6RwUOGrhVH5d6PUmI3jKDaoDotMy0iy-bHyvmXks,18496
|
|
14
|
-
beaver_db-0.17.
|
|
15
|
-
beaver_db-0.17.
|
|
16
|
-
beaver_db-0.17.
|
|
17
|
-
beaver_db-0.17.
|
|
18
|
-
beaver_db-0.17.
|
|
14
|
+
beaver_db-0.17.6.dist-info/METADATA,sha256=nfbNnxeVFvBoqoMxvXNAJ_JxMfnLvok_TY32FCFKqsE,20508
|
|
15
|
+
beaver_db-0.17.6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
16
|
+
beaver_db-0.17.6.dist-info/entry_points.txt,sha256=bd5E2s45PoBdtdR9-ToKSdLNhmHp8naV1lWP5mOzlrc,42
|
|
17
|
+
beaver_db-0.17.6.dist-info/licenses/LICENSE,sha256=1xrIY5JnMk_QDQzsqmVzPIIyCgZAkWCC8kF2Ddo1UT0,1071
|
|
18
|
+
beaver_db-0.17.6.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|