In python 3.10 this script runs as expected, but on 3.11 I get the following error
Traceback (most recent call last):
File "/Users/pcrein/qdash/test.py", line 16, in <module>
app()
File "/Users/pcrein/.pyenv/versions/qdash-3.11.0/lib/python3.11/site-packages/typer/main.py", line 328, in __call__
raise e
File "/Users/pcrein/.pyenv/versions/qdash-3.11.0/lib/python3.11/site-packages/typer/main.py", line 311, in __call__
return get_command(self)(*args, **kwargs)
^^^^^^^^^^^^^^^^^
File "/Users/pcrein/.pyenv/versions/qdash-3.11.0/lib/python3.11/site-packages/typer/main.py", line 364, in get_command
click_command = get_command_from_info(
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pcrein/.pyenv/versions/qdash-3.11.0/lib/python3.11/site-packages/typer/main.py", line 577, in get_command_from_info
) = get_params_convertors_ctx_param_name_from_function(command_info.callback)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pcrein/.pyenv/versions/qdash-3.11.0/lib/python3.11/site-packages/typer/main.py", line 553, in get_params_convertors_ctx_param_name_from_function
click_param, convertor = get_click_param(param)
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pcrein/.pyenv/versions/qdash-3.11.0/lib/python3.11/site-packages/typer/main.py", line 844, in get_click_param
parameter_type = get_click_type(
^^^^^^^^^^^^^^^
File "/Users/pcrein/.pyenv/versions/qdash-3.11.0/lib/python3.11/site-packages/typer/main.py", line 773, in get_click_type
raise RuntimeError(f"Type not yet supported: {annotation}") # pragma no cover
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Type not yet supported: datetime.datetime | None
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_hintsis no longer converting theUnionTypeinto aUnion. I would suggest as a fix thatget_click_paramusetyping.get_origin/get_argsinstead of__args__and__origin__attributes.