Skip to content

API Docs: Move type hints out of signature and into params - #1116

Open
TimMonko wants to merge 1 commit into
napari:mainfrom
TimMonko:enh/autodoc-description
Open

API Docs: Move type hints out of signature and into params#1116
TimMonko wants to merge 1 commit into
napari:mainfrom
TimMonko:enh/autodoc-description

Conversation

@TimMonko

Copy link
Copy Markdown
Member

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:

image

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Aug 19, 2026
@Czaki

Czaki commented Aug 19, 2026

Copy link
Copy Markdown
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 brisvag left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong AFAICT? You can't pass any of those things to the viewer constructor. The current docs are correct. In fact, the constructor signature is wrong even on main.

@TimMonko

Copy link
Copy Markdown
Member Author

The current docs are correct. In fact, the constructor signature is wrong even on main.

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?

@brisvag

brisvag commented Aug 21, 2026

Copy link
Copy Markdown
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants