Open kratsg opened 1 year ago
Agreed on the importance of this request.
Also it would be good if argument annotations were not typed with the same class as the argument name itself. It would mkae it much easier to give a different style to type declarations or to use a callback to fi the problems that @kratsg mentions abouve.
Seems like there might be overlap between this issue and https://github.com/sphinx-doc/sphinx/issues/10785
Describe the bug
For this issue, the code for the project is found here with conf.py and documentation rendered here.
In the code, we have lines like this for our typehints:
which renders as
and
which renders as
And finally, in
conf.py
, we have the aliases defined such as'ArrayLike': 'numpy.typing.ArrayLike'
Here are the issues
astensor
,Literal
gets linked totyping.Literal
instead ofpyhf.typing.Literal
(which is fine! but in other python versions, this comes fromtyping_extensions
which is why we import frompyhf.typing
which has the code for switching where it comes from) since the docs are rendered using python 3.10. Inpercentile
,Literal
does not get cross-referenced, but why?astensor
,numpy.typing.ArrayLike
is not getting cross-referenced at all, but it exists in thenumpy
intersphinx.percentile
,Tensor
is not getting cross-referenced (from the same module) andShape
is not getting cross-referenced (frompyhf.typing
in the same package).How to Reproduce
Recommend python 3.10+ (Sphinx does not correctly process
UnionType
in older python versions).Expected behavior
Expected type aliases to be processed with intersphinx (but also internal cross-referencing working too).
Your project
https://pyhf--1969.org.readthedocs.build/en/1969
Screenshots
No response
OS
Mac 10.14.6 (18G9323)
Python version
Python 3.8.6
Sphinx version
5.1.1
Sphinx extensions
'sphinx.ext.autodoc', 'sphinx.ext.autosummary', 'sphinx.ext.coverage', 'sphinx.ext.mathjax', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode', 'sphinx.ext.githubpages', 'sphinx.ext.intersphinx', 'sphinxcontrib.bibtex', 'sphinx.ext.napoleon', 'sphinx_click.ext', 'nbsphinx', 'sphinx_issues', 'sphinx_copybutton', 'sphinx_togglebutton', 'xref',
Extra tools
No response
Additional context
Related:
10151
10746