API Docs: Move type hints out of signature and into params - #1116
Open
TimMonko wants to merge 1 commit into
Open
API Docs: Move type hints out of signature and into params#1116TimMonko wants to merge 1 commit into
TimMonko wants to merge 1 commit into
Conversation
Contributor
|
For me, the main problem with readability comes from too many parameters. The PR healing symptoms, not reasons. I like to see type annotation next to the parameter name, but if the type is complex, it might reduce readability. |
brisvag
requested changes
Aug 20, 2026
Member
Author
By the current docs, do you mean the parameters section is correct? And by the constructor signature is wrong, you mean that it sohuld not contain the extra params? |
Contributor
|
Correct! Try import napari
napari.Viewer(camera='anything')and it'll fail, because we override the init to only take those parameters there. ViewerModel the same. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Moves the type hints out of the API docs signature. https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autodoc_typehints
and into the parameters section of the docstring. This does mean that parameters without descriptions are now shown in the bulleted (napolean? I think is what its called) parameter list.
Personally, I find this to be overall much more readable, and any issues with it are our problem because of lack of docstrings and means that we should be doing better inside teh napari source code.
This PR on left, 0.8 on right: