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

New hook to customize base list #3014

Closed
wheerd opened this issue Oct 6, 2016 · 0 comments
Closed

New hook to customize base list #3014

wheerd opened this issue Oct 6, 2016 · 0 comments
Labels
extensions:autodoc type:enhancement enhance or introduce a new feature
Milestone

Comments

@wheerd
Copy link
Contributor

wheerd commented Oct 6, 2016

I would like to change the formatting of the base list for classes. Specifially I would like to provide information about parameterized types (e.g. Dict[str, int]). See agronholm/sphinx-autodoc-typehints#8 for how I want to use it.

For that I need a new hook/event similar to the existing autodoc-process-signature. I propose the signature autodoc-process-bases(app, what, name, obj, options, formatted_bases). The first five arguments are exactly the same as for the existing events. The last one is the list of formatted strings generated in add_directive_header for the bases. It can be modified to change what is output. Alternatively, to provide even more freedom, the hook can return a string. This string is then inserted instead of the "Bases: ..." line.

I can provide an implementation in a pull request, if you like the idea.

@tk0miya tk0miya added the type:enhancement enhance or introduce a new feature label Oct 11, 2016
@tk0miya tk0miya added this to the 4.1.0 milestone Mar 27, 2021
tk0miya added a commit to tk0miya/sphinx that referenced this issue May 15, 2021
Add `autodoc-process-bases` to modify the base classes of the class
definitions.  This allows the extensions to insert or modify the list
of the base classes via event-handlers.
tk0miya added a commit that referenced this issue May 17, 2021
Close #3014: autodoc: Add autodoc-process-bases
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
extensions:autodoc type:enhancement enhance or introduce a new feature
Projects
None yet
Development

No branches or pull requests

2 participants