-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
invalid syntax
error on function with docstring using Annotated[]
#80
Comments
Immediate workaround: add Explanation: The issue is that we have to support forward references and explicit string annotations: class A:
def method(self) -> "A": ...
def func() -> "tuple[Any, ...]": ... ...while also supporting string literals: def func() -> Literal["hello"]: ... ...which is not as easy as it seems. Adding In your case, without this import, we try to parse Possible solution: instead of failing on the syntax error and logging a warning, we could fallback to just use this part of the annotation as a string. |
Thanks for asking: no, you won't need |
Okay, great. Thanks for the great package! |
Wanted to confirm that this issue was fixed after updating to |
Describe the bug
mkdocstrings-python
/griffe
fails to build documentation if function usesAnnotated[]
type annotation.To Reproduce
Create a Typer application using
Annotated[]
, which is the preferred way to use it:Expected behavior
No warnings or errors generated and documentation builds/renders successfully.
System (please complete the following information):
mkdocstrings-python
version: 1.1.2Additional context
The text was updated successfully, but these errors were encountered: