Skip to content

Commit 9918488

Browse files
authored
feat(sdk-py): client qparams (#5918)
And add linting & dyanmic version string
1 parent c37c9cb commit 9918488

File tree

10 files changed

+489
-219
lines changed

10 files changed

+489
-219
lines changed

libs/checkpoint/tests/test_redis_cache.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,7 @@ def test_nonexistent_keys(self):
161161
async def test_async_operations(self):
162162
"""Test async set and get operations with sync Redis client."""
163163
# Create sync Redis client and cache (like main integration tests)
164-
client = redis.Redis(
165-
host="localhost", port=6379, db=1, decode_responses=False
166-
)
164+
client = redis.Redis(host="localhost", port=6379, db=1, decode_responses=False)
167165
try:
168166
client.ping()
169167
except Exception:
@@ -189,9 +187,7 @@ async def test_async_operations(self):
189187
async def test_async_clear(self):
190188
"""Test async clear operations with sync Redis client."""
191189
# Create sync Redis client and cache (like main integration tests)
192-
client = redis.Redis(
193-
host="localhost", port=6379, db=1, decode_responses=False
194-
)
190+
client = redis.Redis(host="localhost", port=6379, db=1, decode_responses=False)
195191
try:
196192
client.ping()
197193
except Exception:

libs/langgraph/uv.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libs/prebuilt/uv.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libs/sdk-py/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ lint lint_diff:
1818
[ "$(PYTHON_FILES)" = "" ] || uv run ruff format $(PYTHON_FILES) --diff
1919
[ "$(PYTHON_FILES)" = "" ] || uv run ruff check --select I $(PYTHON_FILES)
2020
[ "$(PYTHON_FILES)" = "" ] || mkdir -p $(MYPY_CACHE) || uv run mypy $(PYTHON_FILES) --cache-dir $(MYPY_CACHE)
21+
uvx ty check .
2122

2223
format format_diff:
2324
uv run ruff check --select I --fix $(PYTHON_FILES)
Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
from langgraph_sdk.auth import Auth
22
from langgraph_sdk.client import get_client, get_sync_client
33

4-
try:
5-
from importlib import metadata
6-
7-
__version__ = metadata.version(__package__)
8-
except metadata.PackageNotFoundError:
9-
__version__ = "unknown"
4+
__version__ = "0.2.1"
105

116
__all__ = ["Auth", "get_client", "get_sync_client"]

libs/sdk-py/langgraph_sdk/auth/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -701,26 +701,28 @@ def _validate_handler(fn: Callable[..., typing.Any]) -> None:
701701
"""
702702
if not inspect.iscoroutinefunction(fn):
703703
raise ValueError(
704-
f"Auth handler '{fn.__name__}' must be an async function. "
704+
f"Auth handler '{getattr(fn, '__name__', fn)}' must be an async function. "
705705
"Add 'async' before 'def' to make it asynchronous and ensure"
706706
" any IO operations are non-blocking."
707707
)
708708

709709
sig = inspect.signature(fn)
710710
if "ctx" not in sig.parameters:
711711
raise ValueError(
712-
f"Auth handler '{fn.__name__}' must have a 'ctx: AuthContext' parameter. "
712+
f"Auth handler '{getattr(fn, '__name__', fn)}' must have a 'ctx: AuthContext' parameter. "
713713
"Update the function signature to include this required parameter."
714714
)
715715
if "value" not in sig.parameters:
716716
raise ValueError(
717-
f"Auth handler '{fn.__name__}' must have a 'value' parameter. "
717+
f"Auth handler '{getattr(fn, '__name__', fn)}' must have a 'value' parameter. "
718718
" The value contains the mutable data being sent to the endpoint."
719719
"Update the function signature to include this required parameter."
720720
)
721721

722722

723-
def is_studio_user(user: types.MinimalUser | types.User | types.UserDict) -> bool:
723+
def is_studio_user(
724+
user: types.MinimalUser | types.BaseUser | types.MinimalUserDict,
725+
) -> bool:
724726
return (
725727
isinstance(user, types.StudioUser)
726728
or isinstance(user, dict)

0 commit comments

Comments
 (0)