-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
type annotations make docs confusing #3178
Comments
Perhaps the sphinx-autodoc-typehints extension? The docs suggest it will remove the types from the method signatures and put them in the in |
Thanks @DocOtak. Are you interested in trying it out? |
@dcherian sure, I'll try it right now with the xarray docs |
If we can't get that sphinx extension to work (I'm not sure if it will handle NumPy style docstrings), another option might to be define type aliases for the longer types, e.g., |
EDIT: ignore, I see you've tried napoleon |
Have you enabled
|
So I think why it isn't putting the types anywhere in the docs is because they already exist (at least for this Dataset The relevant part of the code in the extension appears to be this https://github.com/agronholm/sphinx-autodoc-typehints/blob/master/sphinx_autodoc_typehints.py#L333:L338 It's looking for |
I would be OK with stripping type hints entirely. Our long type annotations are mostly useful for tooling. The short annotations from our numpy-style docstrings are definitely more readable for humans. |
+1 I like the style with Napoleon enabled. It even fixes #3056. |
Yes, this is great! Please send a PR when you're ready :) |
So I made a PR for just removing the type annotations, turns out it is built in to autodoc. Enabling napoleon seems to be less "clean". While it doesn't actually conflict with |
See #3180 for the |
Any recollection as to if these ever worked as expected? Looks like between landing this change and doing the 0.14 release, the sphinx version bumped from 2.1.2 to 2.2.0 which included some changes to autodoc... This PR might be of interest sphinx-doc/sphinx#6592 but it is not immediately obvious to me how/if this could have broken things. |
I tried using sphinx-autodoc-typehints in my own project but I'm getting a gazillion of errors. |
The annotations make this signature basically unreadable to anyone not familiar with them.
Is there a way to hide them in the documentation? Or at least change formatting so it's clearer what the function arguments are?
The text was updated successfully, but these errors were encountered: