-
First Check
Commit to Help
Example Codebelow is the code directly copied from https://typer.tiangolo.com/tutorial/options/help/
There are two unintended behavior here
1. Option can't be instantiated without adding default
Traceback (most recent call last):
File "option.py", line 7, in <module>
lastname: Annotated[str, typer.Option(help="Last name of person to greet.")] = "",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Option() missing 1 required positional argument: 'default'
2.when executed after adding default, it raises RumtimeError
```python
File "python3.11/site-packages/typer/main.py", line 586, in get_click_type
raise RuntimeError(f"Type not yet supported: {annotation}") # pragma no cover
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Type not yet supported: typing.Annotated[str, <typer.models.OptionInfo object at 0x7fd3f15d7dd0>] import typer
from typing_extensions import Annotated
def main(
name: str,
lastname: Annotated[str, typer.Option(help="Last name of person to greet.")] = "",
formal: Annotated[bool, typer.Option(help="Say hi formally.")] = False,
):
"""
Say hi to NAME, optionally with a --lastname.
If --formal is used, say hi very formally.
"""
if formal:
print(f"Good day Ms. {name} {lastname}.")
else:
print(f"Hello {name} {lastname}")
if __name__ == "__main__":
typer.run(main)
|
Beta Was this translation helpful? Give feedback.
Answered by
raceychan
May 4, 2023
Replies: 2 comments
-
similar issue i've found, |
Beta Was this translation helpful? Give feedback.
0 replies
-
Please delete this ... the version should be typer 0.9.0, not 0.0.9 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
raceychan
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please delete this ... the version should be typer 0.9.0, not 0.0.9