Skip to content

Missing bound argument for TypeVar in output #8924

Closed

Description

@jp-larose

Describe the bug
When documenting a typing.TypeVar where the bound argument is specified, I would expect the generated document to show that information.

To Reproduce

$ git clone https://gitlab.com/joel.larose/sphinx_jpl.git
$ cd sphinx_jpl
$ pip install sphinx
$ make html

Compare typevar_example.py to build/html/modules/typevar_example.html
Notice that TypeE and TypeF are both defined with the bound argument, but it does not appear in the final document output.

Expected behaviour
Final output should include the bound argument when producing the output for a TypeVar
e.g.

TypeE = TypeVar('TypeE', bound=A)
"""This type variable is bound by class `A`"""

Should produce something like:

TypeE

This type variable is bound by class A
alias of TypeVar(‘TypeE’, bound=A)

Your project
https://gitlab.com/joel.larose/sphinx_jpl

Environment info

  • OS: Win10
  • Python version: 3.9
  • Sphinx version: 3.5.1
  • Sphinx extensions: sphinx.ext.autodoc, sphinx.ext.autosummary

Additional context
A patch to fix the output for the other arguments of TypeVar was completed in #8471
I suspect the fix for this would be very similar.

Activity

  1. added
    type:enhancement
    and removed on Feb 24, 2021
  2. added this to the 4.0.0 milestone on Feb 24, 2021
  3. added 2 commits that reference this issue on Feb 24, 2021
    a39cf57
    6d91db3
  4. added a commit that references this issue on Mar 11, 2021
    3134085
  5. locked as resolved and limited conversation to collaborators on Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    extensions:autodoctype:enhancement

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions