-
-
Notifications
You must be signed in to change notification settings - Fork 738
✨ Add support for typing.TypeAliasType
as valid parameter type.
#970
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
base: master
Are you sure you want to change the base?
Conversation
…>=4.6.0' to support 'TypeAliasType'
📝 Docs preview for commit e13d1d8 at: https://45f079b8.typertiangolo.pages.dev |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @zarch, thanks for the contribution, we appreciate it!
The CI is currently failing - could you look into that? I'll put the PR in draft in the meantime. The review process will go much smoother once the CI is green 😉
typing.TypeAliasType
as valid parameter type.typing.TypeAliasType
as valid parameter type.
…one argument containing the same TypeVar
📝 Docs preview for commit c97aff6 at: https://8682c9ff.typertiangolo.pages.dev |
@svlandeg I've fixed all the CI. To properly handle the TypeAliasType I also have to update mypy version to The only failing check is the one using Python 3.7 (not supported), se my other PR to bump the minimum requirement to Python 3.8. |
Hello, I was digging on the topic on that matter and I think this PR is incomplete:
type Name = Annotated[str, Argument(help="The human in front of the screen")]
@app.command()
def greet(name: Name):
echo(f"Hello {name}")
@app.command()
def farewell(name: Name):
echo(f"Good bye, {name}") To get it working, I had to modify
from typing import Doc
from pydantic import PositiveInt, validate_call
type Name = Annotated[str, Doc("An human's full name")]
type Age = Annotated[PositiveInt, Doc("An human's age")]
type Identity = tuple[Name, Age]
@app.command()
@validate_call
def register_to_vote(user_identity: Identity):
... Happy to discuss/help on this topic |
See discussion for further details and sample code.