Intersphinx: referencing typing.X

33 views
Skip to first unread message

Zaur Nasibov

unread,
Feb 28, 2020, 4:32:50 PM2/28/20
to sphinx...@googlegroups.com

Dear Sphinx developers and users,

Could you please help an issue of linking to some type hints defined in typing module? The related bigger question is: should the "data" type of PythonDomain also include the "class" role?

The problem is that Intersphinx has trouble referencing to e.g. typing.Any in the following:


.. class:: my_package.MyClass(useful_argument)

   Say something about MyClass

   :param typing.Any useful_argument:  document the very useful_argument
Compiling this rST raises ":py:class reference target not found: typing.Any"

AFAIU, this is due to a fact that typing.Any is defined as an instance of _SpecialForm, hence it is :py:data:, not :py:class: from Intersphinx's viewpoint.

Am I missing something, or this is an expected behavior? How can one reference to typing.Any and other type hints not defined as a class **inside :param: directive**?

Referencing via :data:`typing.Any` works as expected, though one must dig through Python docs' objects.inv or typing module source code to figure the ":data:" part out. Another quick fix was patching object_types definition in PythonDomain: adding 'class' role to 'data' object type.


Thank you!

BR,

Zaur Nasibov

Komiya Takeshi

unread,
Mar 1, 2020, 9:03:30 AM3/1/20
to sphinx...@googlegroups.com
Hi,

Good point. Indeed, Sphinx expects given type in :param:
info-field-list is a kind of classes. So it would not work for
:py:data: objects.
Could you file an issue to GitHub please? I'll consider the good way
to support them.

Thanks,
Takeshi KOMIYA

2020年2月29日(土) 6:32 Zaur Nasibov <basi...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/ae60ee94-67df-7fc6-4270-4faa1fbfbf21%40gmail.com.

mahiviajes agencia en ligne

unread,
Mar 1, 2020, 1:18:03 PM3/1/20
to sphinx...@googlegroups.com
Je n'ai aucun problème avec GitHub? Je vais considérer la bonne façon
pour m'aider à poursuivre le projet, et en plus de m'envoyer le message en espagnol ou en français, merci pour toute votre aide qui me fait  ( no tengo ninguna problema a GitHub? Consideraré la forma correcta
para apoyarlllame de seguir a delante con el projecto , e de mas que me manda los mensaje en español o frances los da gracias por todo ayuda de vosotros que me hace (
I have no problem with GitHub? I will consider the right way
to support me to continue forward with the project, and in addition to sending me the message in Spanish or French, thank you for all your help that makes me



--
soum de mahiviajes

Zaur Nasibov

unread,
Mar 5, 2020, 2:34:11 PM3/5/20
to sphinx-users
Thank you very much! I'll post a detailed issue on Github during the weekend.
> To unsubscribe from this group and stop receiving emails from it, send an email to sphinx...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages