langgraph-checkpoint-sqlite 2.0.0__tar.gz → 2.0.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: langgraph-checkpoint-sqlite
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: Library with a SQLite implementation of LangGraph checkpoint saver.
5
5
  Home-page: https://www.github.com/langchain-ai/langgraph
6
6
  License: MIT
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3.10
12
12
  Classifier: Programming Language :: Python :: 3.11
13
13
  Classifier: Programming Language :: Python :: 3.12
14
14
  Requires-Dist: aiosqlite (>=0.20.0,<0.21.0)
15
- Requires-Dist: langgraph-checkpoint (>=2.0.0,<3.0.0)
15
+ Requires-Dist: langgraph-checkpoint (>=2.0.2,<3.0.0)
16
16
  Project-URL: Repository, https://www.github.com/langchain-ai/langgraph
17
17
  Description-Content-Type: text/markdown
18
18
 
@@ -110,7 +110,7 @@ class SqliteSaver(BaseCheckpointSaver[str]):
110
110
  check_same_thread=False,
111
111
  )
112
112
  ) as conn:
113
- yield SqliteSaver(conn)
113
+ yield cls(conn)
114
114
 
115
115
  def setup(self) -> None:
116
116
  """Set up the checkpoint database.
@@ -389,7 +389,7 @@ class SqliteSaver(BaseCheckpointSaver[str]):
389
389
  >>> from langgraph.checkpoint.sqlite import SqliteSaver
390
390
  >>> with SqliteSaver.from_conn_string(":memory:") as memory:
391
391
  >>> config = {"configurable": {"thread_id": "1", "checkpoint_ns": ""}}
392
- >>> checkpoint = {"ts": "2024-05-04T06:32:42.235444+00:00", "id": "1ef4f797-8335-6428-8001-8a1503f9b875", "data": {"key": "value"}}
392
+ >>> checkpoint = {"ts": "2024-05-04T06:32:42.235444+00:00", "id": "1ef4f797-8335-6428-8001-8a1503f9b875", "channel_values": {"key": "value"}}
393
393
  >>> saved_config = memory.put(config, checkpoint, {"source": "input", "step": 1, "writes": {"key": "value"}}, {})
394
394
  >>> print(saved_config)
395
395
  {'configurable': {'thread_id': '1', 'checkpoint_ns': '', 'checkpoint_id': '1ef4f797-8335-6428-8001-8a1503f9b875'}}
@@ -137,7 +137,7 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
137
137
  AsyncSqliteSaver: A new AsyncSqliteSaver instance.
138
138
  """
139
139
  async with aiosqlite.connect(conn_string) as conn:
140
- yield AsyncSqliteSaver(conn)
140
+ yield cls(conn)
141
141
 
142
142
  def get_tuple(self, config: RunnableConfig) -> Optional[CheckpointTuple]:
143
143
  """Get a checkpoint tuple from the database.
@@ -159,7 +159,7 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
159
159
  if asyncio.get_running_loop() is self.loop:
160
160
  raise asyncio.InvalidStateError(
161
161
  "Synchronous calls to AsyncSqliteSaver are only allowed from a "
162
- "different thread. From the main thread, use the async interface."
162
+ "different thread. From the main thread, use the async interface. "
163
163
  "For example, use `await checkpointer.aget_tuple(...)` or `await "
164
164
  "graph.ainvoke(...)`."
165
165
  )
@@ -191,6 +191,18 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
191
191
  Yields:
192
192
  Iterator[CheckpointTuple]: An iterator of matching checkpoint tuples.
193
193
  """
194
+ try:
195
+ # check if we are in the main thread, only bg threads can block
196
+ # we don't check in other methods to avoid the overhead
197
+ if asyncio.get_running_loop() is self.loop:
198
+ raise asyncio.InvalidStateError(
199
+ "Synchronous calls to AsyncSqliteSaver are only allowed from a "
200
+ "different thread. From the main thread, use the async interface. "
201
+ "For example, use `checkpointer.alist(...)` or `await "
202
+ "graph.ainvoke(...)`."
203
+ )
204
+ except RuntimeError:
205
+ pass
194
206
  aiter_ = self.alist(config, filter=filter, before=before, limit=limit)
195
207
  while True:
196
208
  try:
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "langgraph-checkpoint-sqlite"
3
- version = "2.0.0"
3
+ version = "2.0.2"
4
4
  description = "Library with a SQLite implementation of LangGraph checkpoint saver."
5
5
  authors = []
6
6
  license = "MIT"
@@ -10,7 +10,7 @@ packages = [{ include = "langgraph" }]
10
10
 
11
11
  [tool.poetry.dependencies]
12
12
  python = "^3.9.0"
13
- langgraph-checkpoint = "^2.0.0"
13
+ langgraph-checkpoint = "^2.0.2"
14
14
  aiosqlite = "^0.20.0"
15
15
 
16
16
  [tool.poetry.group.dev.dependencies]