Skip to content

How to exclude an API member from being processed by numpydoc #479

Open
@HealthyPear

Description

@HealthyPear

Context

I need type annotations and this project doesn't support this yet (#196, #356)- I tested out successfully sphinx.ext.napoleon, but that project doesn't provide a validator (crazy, right?), so here I am, awkwardly in the middle of two lovers.

Feature request

Regardless if during Sphinx build or from the pre-commit hook, I would like to specify a list of API members to ignore.

Numpydoc already provides numpydoc_validation_exclude, but that is indeed for validation, not the whole thing.

In fact what I get if I use the following configuration,

extensions = [
    "numpydoc",
    "sphinx.ext.autodoc",
    "sphinx_automodapi.automodapi",
    "sphinx.ext.napoleon",
]
napoleon_numpy_docstring = True
numpydoc_show_class_members = False
# Report warnings for all validation checks except those specified after "all"
numpydoc_validation_checks = {"all", "ES01", "SA01", "EX01", "RT02"}
# for why we currently ignore "RT02" see https://github.com/numpy/numpydoc/issues/244
numpydoc_validation_exclude = {
    "my_module.greeting",
}

with the following function,

def greeting(name: str) -> str:
    """
    Perform a greeting.

    Parameters
    ----------
    name
        Name to use.

    Returns
    -------
    greeting
        The greeting.
    """
    greeting = "Hello " + name
    return greeting

Is this (see that the Parameters section is doubled)?

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions