Using array-like as a type in napoleon without warning

  numpydoc, python, python-sphinx, sphinx-napoleon

I have a project with some functions documented in the napoleon numpy style. In the spirit of numpyness, I have a bunch of function arguments that are of the class array-like. Here is an example:

def foo(x, y):
    """
    Foo the arguments together to make a bar.

    Parameters
    ----------
    x : array-like
        This is an argument.
    y : array-like
        I like it, give me another!

    Returns
    -------
    bar : numpy.ndarray
        Works every time
    """
    pass

This works just fine, and the type is included in the output without a link:

generated

The problem is that I get a warning on every line of every function that has this:

/.../my_project/my_module.py:docstring of my_project.my_module.foo:: WARNING: py:class reference target not found: array-like
/.../my_project/my_module.py:docstring of my_project.my_module.foo:: WARNING: py:class reference target not found: array-like

I am fairly convinced that there is some solution. It appears that PR #7690 addressed this somehow, but I can’t find a meaningful reference "preprocessing" anywhere in the napoleon or broader sphinx documentation.

So how do I get rid of the warning?

Source: Python Questions

LEAVE A COMMENT