beaver-db 0.16.6__tar.gz → 0.16.7__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.

Potentially problematic release.


This version of beaver-db might be problematic. Click here for more details.

Files changed (42) hide show
  1. {beaver_db-0.16.6 → beaver_db-0.16.7}/PKG-INFO +3 -1
  2. {beaver_db-0.16.6 → beaver_db-0.16.7}/README.md +2 -0
  3. {beaver_db-0.16.6 → beaver_db-0.16.7}/beaver/queues.py +17 -2
  4. {beaver_db-0.16.6 → beaver_db-0.16.7}/pyproject.toml +1 -1
  5. {beaver_db-0.16.6 → beaver_db-0.16.7}/.gitignore +0 -0
  6. {beaver_db-0.16.6 → beaver_db-0.16.7}/.python-version +0 -0
  7. {beaver_db-0.16.6 → beaver_db-0.16.7}/LICENSE +0 -0
  8. {beaver_db-0.16.6 → beaver_db-0.16.7}/beaver/__init__.py +0 -0
  9. {beaver_db-0.16.6 → beaver_db-0.16.7}/beaver/blobs.py +0 -0
  10. {beaver_db-0.16.6 → beaver_db-0.16.7}/beaver/channels.py +0 -0
  11. {beaver_db-0.16.6 → beaver_db-0.16.7}/beaver/collections.py +0 -0
  12. {beaver_db-0.16.6 → beaver_db-0.16.7}/beaver/core.py +0 -0
  13. {beaver_db-0.16.6 → beaver_db-0.16.7}/beaver/dicts.py +0 -0
  14. {beaver_db-0.16.6 → beaver_db-0.16.7}/beaver/lists.py +0 -0
  15. {beaver_db-0.16.6 → beaver_db-0.16.7}/beaver/logs.py +0 -0
  16. {beaver_db-0.16.6 → beaver_db-0.16.7}/beaver/types.py +0 -0
  17. {beaver_db-0.16.6 → beaver_db-0.16.7}/beaver/vectors.py +0 -0
  18. {beaver_db-0.16.6 → beaver_db-0.16.7}/design.md +0 -0
  19. {beaver_db-0.16.6 → beaver_db-0.16.7}/examples/async_pubsub.py +0 -0
  20. {beaver_db-0.16.6 → beaver_db-0.16.7}/examples/blobs.py +0 -0
  21. {beaver_db-0.16.6 → beaver_db-0.16.7}/examples/cache.py +0 -0
  22. {beaver_db-0.16.6 → beaver_db-0.16.7}/examples/fts.py +0 -0
  23. {beaver_db-0.16.6 → beaver_db-0.16.7}/examples/fuzzy.py +0 -0
  24. {beaver_db-0.16.6 → beaver_db-0.16.7}/examples/general_test.py +0 -0
  25. {beaver_db-0.16.6 → beaver_db-0.16.7}/examples/graph.py +0 -0
  26. {beaver_db-0.16.6 → beaver_db-0.16.7}/examples/kvstore.py +0 -0
  27. {beaver_db-0.16.6 → beaver_db-0.16.7}/examples/list.py +0 -0
  28. {beaver_db-0.16.6 → beaver_db-0.16.7}/examples/logs.py +0 -0
  29. {beaver_db-0.16.6 → beaver_db-0.16.7}/examples/pqueue.py +0 -0
  30. {beaver_db-0.16.6 → beaver_db-0.16.7}/examples/producer_consumer.py +0 -0
  31. {beaver_db-0.16.6 → beaver_db-0.16.7}/examples/publisher.py +0 -0
  32. {beaver_db-0.16.6 → beaver_db-0.16.7}/examples/pubsub.py +0 -0
  33. {beaver_db-0.16.6 → beaver_db-0.16.7}/examples/rerank.py +0 -0
  34. {beaver_db-0.16.6 → beaver_db-0.16.7}/examples/stress_vectors.py +0 -0
  35. {beaver_db-0.16.6 → beaver_db-0.16.7}/examples/subscriber.py +0 -0
  36. {beaver_db-0.16.6 → beaver_db-0.16.7}/examples/textual_chat.css +0 -0
  37. {beaver_db-0.16.6 → beaver_db-0.16.7}/examples/textual_chat.py +0 -0
  38. {beaver_db-0.16.6 → beaver_db-0.16.7}/examples/type_hints.py +0 -0
  39. {beaver_db-0.16.6 → beaver_db-0.16.7}/examples/vector.py +0 -0
  40. {beaver_db-0.16.6 → beaver_db-0.16.7}/makefile +0 -0
  41. {beaver_db-0.16.6 → beaver_db-0.16.7}/roadmap.md +0 -0
  42. {beaver_db-0.16.6 → beaver_db-0.16.7}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: beaver-db
3
- Version: 0.16.6
3
+ Version: 0.16.7
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
@@ -26,6 +26,8 @@ A fast, single-file, multi-modal database for Python, built with the standard `s
26
26
 
27
27
  `beaver` is the **B**ackend for **E**mbedded, **A**ll-in-one **V**ector, **E**ntity, and **R**elationship storage. It's a simple, local, and embedded database designed to manage complex, modern data types without requiring a database server, built on top of SQLite.
28
28
 
29
+ > If you like beaver's minimalist, no-bullshit philosophy, check out [castor](https://github.com/apiad/castor) for an equally minimalistic approach to task orchestration.
30
+
29
31
  ## Design Philosophy
30
32
 
31
33
  `beaver` is built with a minimalistic philosophy for small, local use cases where a full-blown database server would be overkill.
@@ -11,6 +11,8 @@ A fast, single-file, multi-modal database for Python, built with the standard `s
11
11
 
12
12
  `beaver` is the **B**ackend for **E**mbedded, **A**ll-in-one **V**ector, **E**ntity, and **R**elationship storage. It's a simple, local, and embedded database designed to manage complex, modern data types without requiring a database server, built on top of SQLite.
13
13
 
14
+ > If you like beaver's minimalist, no-bullshit philosophy, check out [castor](https://github.com/apiad/castor) for an equally minimalistic approach to task orchestration.
15
+
14
16
  ## Design Philosophy
15
17
 
16
18
  `beaver` is built with a minimalistic philosophy for small, local use cases where a full-blown database server would be overkill.
@@ -25,6 +25,12 @@ class AsyncQueueManager[T]:
25
25
  """Asynchronously adds an item to the queue with a specific priority."""
26
26
  await asyncio.to_thread(self._queue.put, data, priority)
27
27
 
28
+ async def peek(self) -> QueueItem[T] | None:
29
+ """
30
+ Asynchronously returns the first item without removing it, if any, otherwise returns None.
31
+ """
32
+ return await asyncio.to_thread(self._queue.peek)
33
+
28
34
  @overload
29
35
  async def get(self, block: Literal[True] = True, timeout: float | None = None) -> QueueItem[T]: ...
30
36
  @overload
@@ -77,7 +83,7 @@ class QueueManager[T]:
77
83
  (self._name, priority, time.time(), self._serialize(data)),
78
84
  )
79
85
 
80
- def _get_item_atomically(self) -> QueueItem[T] | None:
86
+ def _get_item_atomically(self, pop:bool=True) -> QueueItem[T] | None:
81
87
  """
82
88
  Performs a single, atomic attempt to retrieve and remove the
83
89
  highest-priority item from the queue. Returns None if the queue is empty.
@@ -100,12 +106,21 @@ class QueueManager[T]:
100
106
  return None
101
107
 
102
108
  rowid, priority, timestamp, data = result
103
- cursor.execute("DELETE FROM beaver_priority_queues WHERE rowid = ?", (rowid,))
109
+
110
+ if pop:
111
+ cursor.execute("DELETE FROM beaver_priority_queues WHERE rowid = ?", (rowid,))
104
112
 
105
113
  return QueueItem(
106
114
  priority=priority, timestamp=timestamp, data=self._deserialize(data)
107
115
  )
108
116
 
117
+ def peek(self) -> QueueItem[T] | None:
118
+ """
119
+ Retrieves the first item of the queue.
120
+ If the queue is empy, returns None.
121
+ """
122
+ return self._get_item_atomically(pop=False)
123
+
109
124
  @overload
110
125
  def get(self, block: Literal[True] = True, timeout: float | None = None) -> QueueItem[T]: ...
111
126
  @overload
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "beaver-db"
3
- version = "0.16.6"
3
+ version = "0.16.7"
4
4
  description = "Fast, embedded, and multi-modal DB based on SQLite for AI-powered applications."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes