sphinx-doc / sphinx-doc/sphinx
autodoc for generic classes should include the type parameters
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 8k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
Currently, when autodoc renders a class of the form class Foo(Generic[T]), the resulting HTML just shows "class modulename.Foo", which omits information, as the type parameter is not shown. The only way to show the type parameter at the moment is to use :show-inheritance: to add a line of the form "Bases: Generic[T]". A generic class should instead be rendered as "class modulename.Foo[T]".
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in Sphinx autodoc's class-rendering path and trace how generic bases are represented in the generated HTML. Check the existing output for a class declared as Generic[T], then update the relevant rendering behavior and verify that the result includes the type parameter as modulename.Foo[T] without relying on show-inheritance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100