DOC: Remove dependency on sphinx_autodoc_typehints #20875
Merged
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.
sphinx_autodoc_typehints
does not have any support for declaring type aliases (see tox-dev/sphinx-autodoc-typehints#132 and tox-dev/sphinx-autodoc-typehints#284). The only option is using theirtypehints_formatter
config, which we probably shouldn't use because it breaks sphinx cacheing (see #20872)The net result is that aliases like
ArrayLike
andDtypeLike
are expanded into their full unions in our docs, which makes for a poor user experience. For example: here are the currentjax.lax.argmin
docs:This PR removes the
sphinx_autodoc_typehints
extension, and instead uses sphinx's native typehint handlers; the result is this:I have tried unsuccessfully to figure out how to make
jax.typing.ArrayLike
andjax.typing.DtypeLike
link to their documentation page, but I think this is better than the current version.