Skip to content
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

[Feature request] Support Annotated (Python 3.7+) #293

Open
Diogo-Rossi opened this issue Nov 4, 2024 · 0 comments
Open

[Feature request] Support Annotated (Python 3.7+) #293

Diogo-Rossi opened this issue Nov 4, 2024 · 0 comments
Labels

Comments

@Diogo-Rossi
Copy link

The Annotated typing is a special type to add context-specific metadata to an annotation.

The doc-string generation could ignore it, as in the docs:

If a library or tool encounters an annotation Annotated[T, x] and has no special logic for the metadata, it should ignore the metadata and simply treat the annotation as T. As such, Annotated can be useful for code that wants to use annotations for purposes outside Python’s static typing system.

A direct use case for this can be, for instance, the Typer library.

Example code

import typer
from typing_extensions import Annotated


def main(name: Annotated[str, typer.Argument()]):
    print(f"Hello {name}")

Expected Result

def main(name: Annotated[str, typer.Argument()]):
    """_summary_

    _extended_summary_

    Args:
        name (str): _description_
    """
    print(f"Hello {name}")

Actual Result

def main(name: Annotated[str, typer.Argument()]):
    """_summary_

    _extended_summary_

    Args:
        name (Annotated[str, typer.Argument): _description_
    """
    print(f"Hello {name}")
@Diogo-Rossi Diogo-Rossi added the bug label Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant