langgraph-runtime-inmem 0.23.0__tar.gz → 0.23.1__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.
- {langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/PKG-INFO +1 -1
- {langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/langgraph_runtime_inmem/__init__.py +1 -1
- {langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/langgraph_runtime_inmem/_persistence.py +6 -0
- {langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/langgraph_runtime_inmem/routes.py +7 -0
- {langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/langgraph_runtime_inmem/store.py +13 -13
- {langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/.gitignore +0 -0
- {langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/Makefile +0 -0
- {langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/README.md +0 -0
- {langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/langgraph_runtime_inmem/checkpoint.py +0 -0
- {langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/langgraph_runtime_inmem/database.py +0 -0
- {langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/langgraph_runtime_inmem/inmem_stream.py +0 -0
- {langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/langgraph_runtime_inmem/lifespan.py +0 -0
- {langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/langgraph_runtime_inmem/metrics.py +0 -0
- {langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/langgraph_runtime_inmem/ops.py +0 -0
- {langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/langgraph_runtime_inmem/queue.py +0 -0
- {langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/langgraph_runtime_inmem/retry.py +0 -0
- {langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/pyproject.toml +0 -0
- {langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/uv.lock +0 -0
|
@@ -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:
|
{langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/langgraph_runtime_inmem/routes.py
RENAMED
|
@@ -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 []
|
{langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/langgraph_runtime_inmem/store.py
RENAMED
|
@@ -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
|
|
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 =
|
|
33
|
-
|
|
34
|
-
|
|
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
|
|
62
|
-
|
|
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):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/langgraph_runtime_inmem/metrics.py
RENAMED
|
File without changes
|
{langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/langgraph_runtime_inmem/ops.py
RENAMED
|
File without changes
|
{langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/langgraph_runtime_inmem/queue.py
RENAMED
|
File without changes
|
{langgraph_runtime_inmem-0.23.0 → langgraph_runtime_inmem-0.23.1}/langgraph_runtime_inmem/retry.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|