Skip to content

Commit e827bf7

Browse files
matthewshirleybsbodden
authored andcommitted
chore(deps): align redis constraint with documentation and fix type compatibility
- Update redis constraint from ^6.2.0 to >=5.2.1,<7.0.0 per README - Add type casts for JSONCommands.set() to satisfy stricter JsonType in redis-py 6.3.0+ - Cast channel_values in shallow.py for _deserialize_channel_values compatibility - All 350 tests pass with redis >=5.2.1,<7.0.0
1 parent e4eccee commit e827bf7

File tree

5 files changed

+121
-62
lines changed

5 files changed

+121
-62
lines changed

langgraph/checkpoint/redis/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ def put_writes(
601601
idx_value,
602602
)
603603
write_keys.append(key)
604-
pipeline.json().set(key, "$", write_obj)
604+
pipeline.json().set(key, "$", cast(Any, write_obj))
605605
created_keys.append(key)
606606

607607
# Add TTL operations to the pipeline if configured
@@ -636,7 +636,7 @@ def put_writes(
636636
task_id,
637637
idx_value,
638638
)
639-
fallback_pipeline.json().set(key, "$", write_obj)
639+
fallback_pipeline.json().set(key, "$", cast(Any, write_obj))
640640

641641
# Add TTL operations if configured
642642
if (

langgraph/checkpoint/redis/aio.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,7 @@ async def aput_writes(
11411141
)
11421142

11431143
# Redis JSON.SET is an UPSERT by default
1144-
await self._redis.json().set(key, "$", write_obj) # type: ignore[misc]
1144+
await self._redis.json().set(key, "$", cast(Any, write_obj)) # type: ignore[misc]
11451145
created_keys.append(key)
11461146

11471147
# Apply TTL to newly created keys
@@ -1197,7 +1197,7 @@ async def aput_writes(
11971197
write_obj["idx"], # type: ignore[arg-type]
11981198
)
11991199

1200-
pipeline.json().set(key, "$", write_obj)
1200+
pipeline.json().set(key, "$", cast(Any, write_obj))
12011201
created_keys.append(key)
12021202

12031203
# Add TTL operations to the pipeline if configured
@@ -1264,7 +1264,9 @@ async def aput_writes(
12641264
task_id,
12651265
write_obj["idx"], # type: ignore[arg-type]
12661266
)
1267-
fallback_pipeline.json().set(key, "$", write_obj)
1267+
fallback_pipeline.json().set(
1268+
key, "$", cast(Any, write_obj)
1269+
)
12681270

12691271
# Add TTL operations if configured
12701272
if (

langgraph/checkpoint/redis/shallow.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,12 @@ def get_channel_values(
638638
channel_values = checkpoint.get("channel_values", {})
639639

640640
# Deserialize channel values since they're stored in serialized form
641-
return self._deserialize_channel_values(channel_values)
641+
# Cast to dict[str, Any] as we know this is the correct type from checkpoint structure
642+
from typing import cast
643+
644+
return self._deserialize_channel_values(
645+
cast(dict[str, Any], channel_values) if channel_values else {}
646+
)
642647

643648
def _load_pending_sends(
644649
self,

0 commit comments

Comments
 (0)