langgraph-runtime-inmem 0.23.0__py3-none-any.whl → 0.23.1__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.
@@ -10,7 +10,7 @@ from langgraph_runtime_inmem import (
10
10
  store,
11
11
  )
12
12
 
13
- __version__ = "0.23.0"
13
+ __version__ = "0.23.1"
14
14
  __all__ = [
15
15
  "ops",
16
16
  "database",
@@ -4,6 +4,7 @@ from __future__ import annotations
4
4
 
5
5
  import functools
6
6
  import logging
7
+ import os
7
8
  import threading
8
9
  import weakref
9
10
 
@@ -14,10 +15,15 @@ logger = logging.getLogger(__name__)
14
15
  _stores: dict[str, weakref.ref[PersistentDict]] = {}
15
16
  _flush_thread: tuple[threading.Event, threading.Thread] | None = None
16
17
  _flush_interval: int = 10
18
+ DISABLE_FILE_PERSISTENCE = (
19
+ os.getenv("LANGGRAPH_DISABLE_FILE_PERSISTENCE", "false").lower() == "true"
20
+ )
17
21
 
18
22
 
19
23
  def register_persistent_dict(d: PersistentDict) -> None:
20
24
  """Register a PersistentDict for periodic flushing."""
25
+ if DISABLE_FILE_PERSISTENCE:
26
+ return
21
27
  global _flush_thread
22
28
  _stores[d.filename] = weakref.ref(d)
23
29
  if _flush_thread is None:
@@ -8,6 +8,13 @@ from langgraph_runtime_inmem.database import connect
8
8
  def get_internal_routes():
9
9
  from langgraph_api.config import MIGRATIONS_PATH
10
10
 
11
+ try:
12
+ from langgraph_api.middleware import http_logger
13
+
14
+ http_logger.PATHS_IGNORE.add("/internal/truncate")
15
+ except ImportError:
16
+ pass
17
+
11
18
  if "__inmem" not in MIGRATIONS_PATH:
12
19
  # not in a testing mode.
13
20
  return []
@@ -10,29 +10,27 @@ from langgraph.store.base import BaseStore, Op, Result
10
10
  from langgraph.store.base.batch import AsyncBatchedBaseStore
11
11
  from langgraph.store.memory import InMemoryStore
12
12
 
13
- from langgraph_runtime_inmem._persistence import register_persistent_dict
13
+ from langgraph_runtime_inmem import _persistence
14
14
 
15
15
  _STORE_CONFIG = None
16
- DISABLE_FILE_PERSISTENCE = (
17
- os.getenv("LANGGRAPH_DISABLE_FILE_PERSISTENCE", "false").lower() == "true"
18
- )
19
16
 
20
17
 
21
18
  class DiskBackedInMemStore(InMemoryStore):
22
19
  def __init__(self, *args: Any, **kwargs: Any) -> None:
23
20
  super().__init__(*args, **kwargs)
24
- if not DISABLE_FILE_PERSISTENCE:
21
+ if not _persistence.DISABLE_FILE_PERSISTENCE:
25
22
  self._data = PersistentDict(dict, filename=_STORE_FILE)
26
23
  self._vectors = PersistentDict(
27
24
  lambda: defaultdict(dict), filename=_VECTOR_FILE
28
25
  )
29
- register_persistent_dict(self._data)
30
- register_persistent_dict(self._vectors)
26
+ _persistence.register_persistent_dict(self._data)
27
+ _persistence.register_persistent_dict(self._vectors)
28
+ self._load_data(self._data, which="data")
29
+ self._load_data(self._vectors, which="vectors")
31
30
  else:
32
- self._data = InMemoryStore._data
33
- self._vectors = InMemoryStore._vectors
34
- self._load_data(self._data, which="data")
35
- self._load_data(self._vectors, which="vectors")
31
+ self._data = defaultdict(dict)
32
+ # [ns][key][path]
33
+ self._vectors = defaultdict(lambda: defaultdict(dict))
36
34
 
37
35
  def _load_data(self, container: PersistentDict, which: str) -> None:
38
36
  if not container.filename:
@@ -58,8 +56,10 @@ class DiskBackedInMemStore(InMemoryStore):
58
56
  return asyncio.create_task(asyncio.sleep(0))
59
57
 
60
58
  def close(self) -> None:
61
- self._data.close()
62
- self._vectors.close()
59
+ if isinstance(self._data, PersistentDict):
60
+ self._data.close()
61
+ if isinstance(self._vectors, PersistentDict):
62
+ self._vectors.close()
63
63
 
64
64
 
65
65
  class BatchedStore(AsyncBatchedBaseStore):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langgraph-runtime-inmem
3
- Version: 0.23.0
3
+ Version: 0.23.1
4
4
  Summary: Inmem implementation for the LangGraph API server.
5
5
  Author-email: Will Fu-Hinthorn <will@langchain.dev>
6
6
  License: Elastic-2.0
@@ -1,5 +1,5 @@
1
- langgraph_runtime_inmem/__init__.py,sha256=oKfMmvvPRewTlo9oduB3tCC3l2b2MiD_9lka4PMm_5M,337
2
- langgraph_runtime_inmem/_persistence.py,sha256=exchMr_NQB_h7PHt0vq5QBh25cOGoW0jHAFo07b1BFI,1711
1
+ langgraph_runtime_inmem/__init__.py,sha256=D9oGOcx4U1hp9tKw_-AFKVGi4nI5GYSdCpnBhzFVnR0,337
2
+ langgraph_runtime_inmem/_persistence.py,sha256=0h_HLXc079TG0rXoiQjICPZLhhBpTsmZ2PG8UbB5YY4,1879
3
3
  langgraph_runtime_inmem/checkpoint.py,sha256=VD5c6CktsToo_f4qPe1WP_csdonQoOb7h5lHv4U0ZAE,8372
4
4
  langgraph_runtime_inmem/database.py,sha256=iP7W1SI4kUkqcHtkg3aMmP-YLgZfvMHANwN-P4Pb1pY,6607
5
5
  langgraph_runtime_inmem/inmem_stream.py,sha256=PFLWbsxU8RqbT5mYJgNk6v5q6TWJRIY1hkZWhJF8nkI,9094
@@ -8,8 +8,8 @@ langgraph_runtime_inmem/metrics.py,sha256=_YiSkLnhQvHpMktk38SZo0abyL-5GihfVAtBo0
8
8
  langgraph_runtime_inmem/ops.py,sha256=OZ1VicFoh9eOxD15LbZsmCZ1JTaWkMUjdY0nF0t9e-k,120806
9
9
  langgraph_runtime_inmem/queue.py,sha256=WM6ZJu25QPVjFXeJYW06GALLUgRsnRrA4YdypR0oG0U,9584
10
10
  langgraph_runtime_inmem/retry.py,sha256=XmldOP4e_H5s264CagJRVnQMDFcEJR_dldVR1Hm5XvM,763
11
- langgraph_runtime_inmem/routes.py,sha256=VVNxgJ8FWI3kDBoIgQUWN1gY5ivo7L954Agxzv72TAY,1377
12
- langgraph_runtime_inmem/store.py,sha256=a3YKsLnFv4bu3zPvagIFv0xmtrIp_pmGvj1CnD3PHL0,3682
13
- langgraph_runtime_inmem-0.23.0.dist-info/METADATA,sha256=9x1G8RrISXklr1MikxsE4kJFZTswjmATqNgA0EsPQYY,570
14
- langgraph_runtime_inmem-0.23.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
15
- langgraph_runtime_inmem-0.23.0.dist-info/RECORD,,
11
+ langgraph_runtime_inmem/routes.py,sha256=25W-8fQCmBD3MHTv91GIGgBl8tfl-MovdXDd34yVkzM,1541
12
+ langgraph_runtime_inmem/store.py,sha256=EehjI-LWemnMYqDeMJp75hvZK8oInZL-JhnfnEwtlPk,3751
13
+ langgraph_runtime_inmem-0.23.1.dist-info/METADATA,sha256=waXdjJtsILPbF6sOf5enVzC-un7WNJDm0UCUoNJxDtk,570
14
+ langgraph_runtime_inmem-0.23.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
15
+ langgraph_runtime_inmem-0.23.1.dist-info/RECORD,,