2

When I'm writing docstrings for my python packages, I just cannot make the functions appear in See Also section linkable, especially for the functions that belongs to other modules, could some one help me to fix this issue, thanks!

BTW, I'm following the numpy docstring rules, and all the API docs is generated from sphinx-autogen, below is a basic example:

In module mod1:

def f_add(x, y):
    """Return sum of two input numbers. 

    Parameters
    ----------
    x : float
        First input number.
    y : float
        Second input number.

    Returns
    -------
    s : float
        Sum of two input numbers.

    See Also
    --------
    f_mul : Multiply function.
    """

However f_mul is in another module: mod2, what is the right way to make f_mul in See Also of f_add linkable?

Updated: :func:`f_mul` actually works, but not so neat in CLI.

Tong
  • 2,057
  • 2
  • 15
  • 20
  • You can try *See Also** .. seealso:: f_mul – nick_gabpe Dec 05 '16 at 17:44
  • @nick_gabpe That does not work either, only :func:`f_mul` works, but this way looks not neat in the command line interface environment. – Tong Dec 05 '16 at 18:44
  • @Tong Have you solved it since then? I have the same problem: I want to have links to built-in Python functions (e.g. `zipfile.ZipFile`), to third-party functions (e.g. `numpy.vstack`) and to my own functions from another module (e.g. `my_other_module.my_func`). – Zoltán Csáti Jul 20 '20 at 11:58
  • @ZoltánCsáti The following link would help you: https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html – Tong Jul 30 '20 at 18:04
  • @Tong Thanks, that solved all my problems! For reference, check [this thread](https://stackoverflow.com/questions/21538983/specifying-targets-for-intersphinx-links-to-numpy-scipy-and-matplotlib). – Zoltán Csáti Jul 31 '20 at 08:05

0 Answers0