Skip to content

Add an autodoc_typehints_return option #13489

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

Open
ego-thales opened this issue Apr 17, 2025 · 0 comments
Open

Add an autodoc_typehints_return option #13489

ego-thales opened this issue Apr 17, 2025 · 0 comments
Labels
type:proposal a feature suggestion

Comments

@ego-thales
Copy link

Hi there,

I think it would be cool to explicitly tell autodoc not to document the return type automatically when autodoc_typehints in {"description", "both"}.

Indeed, it is generally ugly when documenting a tuple return type such as the following.

def foo(): -> tuple[int, int]:
    """Foooo.

    Returns
    -------
    a: int
        Bar.
    b: int
        Baz.
    """
    return 0, 1

Note that the napoleon option napoleon_use_rtype = False does not work, and also, one cannot use the autodoc-process-docstring event since the return type specification seems to be added after it...

Options could be "all", "none", "undocumented" for example.

All the best!
Élie.

@ego-thales ego-thales added the type:proposal a feature suggestion label Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:proposal a feature suggestion
Projects
None yet
Development

No branches or pull requests

1 participant