langgraph-checkpoint-sqlite 2.0.2__tar.gz → 2.0.3__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.2
3
+ Version: 2.0.3
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.2,<3.0.0)
15
+ Requires-Dist: langgraph-checkpoint (>=2.0.10,<3.0.0)
16
16
  Project-URL: Repository, https://www.github.com/langchain-ai/langgraph
17
17
  Description-Content-Type: text/markdown
18
18
 
@@ -424,6 +424,7 @@ class SqliteSaver(BaseCheckpointSaver[str]):
424
424
  config: RunnableConfig,
425
425
  writes: Sequence[Tuple[str, Any]],
426
426
  task_id: str,
427
+ task_path: str = "",
427
428
  ) -> None:
428
429
  """Store intermediate writes linked to a checkpoint.
429
430
 
@@ -433,6 +434,7 @@ class SqliteSaver(BaseCheckpointSaver[str]):
433
434
  config (RunnableConfig): Configuration of the related checkpoint.
434
435
  writes (Sequence[Tuple[str, Any]]): List of writes to store, each as (channel, value) pair.
435
436
  task_id (str): Identifier for the task creating the writes.
437
+ task_path (str): Path of the task creating the writes.
436
438
  """
437
439
  query = (
438
440
  "INSERT OR REPLACE INTO writes (thread_id, checkpoint_ns, checkpoint_id, task_id, idx, channel, type, value) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
@@ -1,17 +1,8 @@
1
1
  import asyncio
2
2
  import random
3
+ from collections.abc import AsyncIterator, Iterator, Sequence
3
4
  from contextlib import asynccontextmanager
4
- from typing import (
5
- Any,
6
- AsyncIterator,
7
- Callable,
8
- Dict,
9
- Iterator,
10
- Optional,
11
- Sequence,
12
- Tuple,
13
- TypeVar,
14
- )
5
+ from typing import Any, Callable, Optional, TypeVar
15
6
 
16
7
  import aiosqlite
17
8
  from langchain_core.runnables import RunnableConfig
@@ -173,7 +164,7 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
173
164
  self,
174
165
  config: Optional[RunnableConfig],
175
166
  *,
176
- filter: Optional[Dict[str, Any]] = None,
167
+ filter: Optional[dict[str, Any]] = None,
177
168
  before: Optional[RunnableConfig] = None,
178
169
  limit: Optional[int] = None,
179
170
  ) -> Iterator[CheckpointTuple]:
@@ -207,7 +198,7 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
207
198
  while True:
208
199
  try:
209
200
  yield asyncio.run_coroutine_threadsafe(
210
- anext(aiter_),
201
+ anext(aiter_), # noqa: F821
211
202
  self.loop,
212
203
  ).result()
213
204
  except StopAsyncIteration:
@@ -239,10 +230,14 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
239
230
  ).result()
240
231
 
241
232
  def put_writes(
242
- self, config: RunnableConfig, writes: Sequence[Tuple[str, Any]], task_id: str
233
+ self,
234
+ config: RunnableConfig,
235
+ writes: Sequence[tuple[str, Any]],
236
+ task_id: str,
237
+ task_path: str = "",
243
238
  ) -> None:
244
239
  return asyncio.run_coroutine_threadsafe(
245
- self.aput_writes(config, writes, task_id), self.loop
240
+ self.aput_writes(config, writes, task_id, task_path), self.loop
246
241
  ).result()
247
242
 
248
243
  async def setup(self) -> None:
@@ -372,7 +367,7 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
372
367
  self,
373
368
  config: Optional[RunnableConfig],
374
369
  *,
375
- filter: Optional[Dict[str, Any]] = None,
370
+ filter: Optional[dict[str, Any]] = None,
376
371
  before: Optional[RunnableConfig] = None,
377
372
  limit: Optional[int] = None,
378
373
  ) -> AsyncIterator[CheckpointTuple]:
@@ -398,9 +393,11 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
398
393
  ORDER BY checkpoint_id DESC"""
399
394
  if limit:
400
395
  query += f" LIMIT {limit}"
401
- async with self.lock, self.conn.execute(
402
- query, params
403
- ) as cur, self.conn.cursor() as wcur:
396
+ async with (
397
+ self.lock,
398
+ self.conn.execute(query, params) as cur,
399
+ self.conn.cursor() as wcur,
400
+ ):
404
401
  async for (
405
402
  thread_id,
406
403
  checkpoint_ns,
@@ -467,16 +464,19 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
467
464
  checkpoint_ns = config["configurable"]["checkpoint_ns"]
468
465
  type_, serialized_checkpoint = self.serde.dumps_typed(checkpoint)
469
466
  serialized_metadata = self.jsonplus_serde.dumps(metadata)
470
- async with self.lock, self.conn.execute(
471
- "INSERT OR REPLACE INTO checkpoints (thread_id, checkpoint_ns, checkpoint_id, parent_checkpoint_id, type, checkpoint, metadata) VALUES (?, ?, ?, ?, ?, ?, ?)",
472
- (
473
- str(config["configurable"]["thread_id"]),
474
- checkpoint_ns,
475
- checkpoint["id"],
476
- config["configurable"].get("checkpoint_id"),
477
- type_,
478
- serialized_checkpoint,
479
- serialized_metadata,
467
+ async with (
468
+ self.lock,
469
+ self.conn.execute(
470
+ "INSERT OR REPLACE INTO checkpoints (thread_id, checkpoint_ns, checkpoint_id, parent_checkpoint_id, type, checkpoint, metadata) VALUES (?, ?, ?, ?, ?, ?, ?)",
471
+ (
472
+ str(config["configurable"]["thread_id"]),
473
+ checkpoint_ns,
474
+ checkpoint["id"],
475
+ config["configurable"].get("checkpoint_id"),
476
+ type_,
477
+ serialized_checkpoint,
478
+ serialized_metadata,
479
+ ),
480
480
  ),
481
481
  ):
482
482
  await self.conn.commit()
@@ -491,8 +491,9 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
491
491
  async def aput_writes(
492
492
  self,
493
493
  config: RunnableConfig,
494
- writes: Sequence[Tuple[str, Any]],
494
+ writes: Sequence[tuple[str, Any]],
495
495
  task_id: str,
496
+ task_path: str = "",
496
497
  ) -> None:
497
498
  """Store intermediate writes linked to a checkpoint asynchronously.
498
499
 
@@ -502,6 +503,7 @@ class AsyncSqliteSaver(BaseCheckpointSaver[str]):
502
503
  config (RunnableConfig): Configuration of the related checkpoint.
503
504
  writes (Sequence[Tuple[str, Any]]): List of writes to store, each as (channel, value) pair.
504
505
  task_id (str): Identifier for the task creating the writes.
506
+ task_path (str): Path of the task creating the writes.
505
507
  """
506
508
  query = (
507
509
  "INSERT OR REPLACE INTO writes (thread_id, checkpoint_ns, checkpoint_id, task_id, idx, channel, type, value) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "langgraph-checkpoint-sqlite"
3
- version = "2.0.2"
3
+ version = "2.0.3"
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.2"
13
+ langgraph-checkpoint = "^2.0.10"
14
14
  aiosqlite = "^0.20.0"
15
15
 
16
16
  [tool.poetry.group.dev.dependencies]