Skip to content

Commit 0ee0a78

Browse files
Fix typer signature inspection issue with CodegenSession
- Updated requires_auth decorator to hide session parameter from Typer's signature inspection - This prevents the 'Type not yet supported: CodegenSession' runtime error - Typer now only sees the actual CLI parameters, not the injected session parameter
1 parent dc0f696 commit 0ee0a78

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/codegen/cli/auth/decorators.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import functools
2+
import inspect
23
from collections.abc import Callable
34

45
import rich
@@ -36,4 +37,10 @@ def wrapper(*args, **kwargs):
3637

3738
return f(*args, session=session, **kwargs)
3839

40+
# Remove the session parameter from the wrapper's signature so Typer doesn't see it
41+
sig = inspect.signature(f)
42+
new_params = [param for name, param in sig.parameters.items() if name != 'session']
43+
new_sig = sig.replace(parameters=new_params)
44+
wrapper.__signature__ = new_sig
45+
3946
return wrapper

0 commit comments

Comments
 (0)