-
-
Notifications
You must be signed in to change notification settings - Fork 624
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using some_type | None
syntax for type annotations causes error in python 3.11
#533
Comments
I'm having the same issue. Using |
@tiangolo, Any updates on this feature? |
Related to |
Hi and thanks a lot for this great library! I've run into this issue as well. May someone provide some guidance on what should be fixed, |
I have the same issue with Python 3.10. Any advisory on how to fix this? |
Switching from |
That is a pretty good workaround, but for me it means that I have to configure my linters one way for modules that use typer and another way for the rest of the code. |
pyupgrade will respect type aliases, as will typer. It's unwieldy, but this means you can do the following without having to configure pyupgrade to keep runtime types:
|
For me, I'd rather use I think the idea here is that we ideally want to use |
Agree, for now I've just disabled linting in that specific line, in Ruff you can do it with |
It would be great to use |
I am stuck between Typer not supporting the new python syntax with
|
First Check
Commit to Help
Example Code
Description
In python 3.10 this script runs as expected, but on 3.11 I get the following error
Operating System
macOS
Operating System Details
No response
Typer Version
0.7.0
Python Version
3.11.0
Additional Context
I believe the issue is that for some reason,
typing.get_type_hints
is no longer converting theUnionType
into aUnion
. I would suggest as a fix thatget_click_param
usetyping.get_origin/get_args
instead of__args__
and__origin__
attributes.The text was updated successfully, but these errors were encountered: