Search code examples
pythondocumentationpython-sphinxcross-reference

sphinx not linking to multiprocessing.Value


I am using Sphinx to document a small project I am working on. I am using Python multiprocessing Queue and Value constructs, and I want Sphinx to link to the correct documentation. I am quite new to using Sphinx, so I am having trouble understanding what I may be doing wrong.

I have these two lines in my code, the link to Queue works correctly and links here As expected. But the second one, which should link here Does not.

:type param1: :class:~multiprocessing.Queue

:type param2: :method:~multiprocessing.Value (Also tried with :class:, :function:, :attribute:)

Both of these are in the docstring of the function, and sphinx is correctly generating the rest of it as I expect, only problem is that it isn't linking to the multiprocessing.Value documentation.


Solution

  • multiprocessing.Value is a function and the proper cross-reference role is :func:. The following markup should work for you:

    :type param2: :func:`~multiprocessing.Value`