๐ŸŒ
Readthedocs
numpydoc.readthedocs.io โ€บ en โ€บ latest โ€บ format.html
Style guide โ€” numpydoc v1.11.1.dev1+gca74aae44 Manual
This leads to the following style recommendations: Module, class, function, method, and attribute names should render as hyperlinks in monospaced font (e.g. numpy); depending on project settings, this may be accomplished simply be enclosing them in single backticks.
๐ŸŒ
NumPy
numpy.org โ€บ numtype โ€บ dev โ€บ style
Style Guide - NumType
In line with both optype and the stub style guide, NumType also uses Has{} for single-attribute protocols, with {} the CamelCase attribute name.
๐ŸŒ
Sphinx
sphinx-doc.org โ€บ en โ€บ master โ€บ usage โ€บ extensions โ€บ example_numpy.html
Example NumPy Style Python Docstrings โ€” Sphinx documentation
Returns ------- bool True if successful, False otherwise. """ def function_with_pep484_type_annotations(param1: int, param2: str) -> bool: """Example function with PEP 484 type annotations. The return type must be duplicated in the docstring to comply with the NumPy docstring style.
๐ŸŒ
Medium
medium.com โ€บ @kurniawanwawan1707 โ€บ creating-numpy-style-documentation-9e89fb37a763
Creating NumPy Style Documentation | by Rizki Kurniawan | Medium
May 11, 2023 - In documenting a Python library, you can use some common styles, such as Google style and NumPy style. In this article, I would like to tell about NumPy style documentation. The NumPy style guide can be found here.
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 1.18 โ€บ dev โ€บ style_guide.html
NumPy C Style Guide โ€” NumPy v1.18 Manual
Function and macro call style: foo(a, b, c), no space before the open paren, no spaces inside the parens, no spaces before commas, one space after each comma.
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 1.20 โ€บ docs โ€บ howto_document.html
A Guide to NumPy Documentation โ€” NumPy v1.20 Manual
January 31, 2021 - In general, we follow the Google developer documentation style guide. ... We pluralize index as indices rather than indexes, following the precedent of numpy.indices.
๐ŸŒ
Readthedocs
sphinxcontrib-napoleon.readthedocs.io โ€บ en โ€บ latest โ€บ example_numpy.html
Example NumPy Style Python Docstrings โ€” napoleon 0.7 documentation
.. _PEP 484: https://www.python.org/dev/peps/pep-0484/ """ def function_with_pep484_type_annotations(param1: int, param2: str) -> bool: """Example function with PEP 484 type annotations. The return type must be duplicated in the docstring to comply with the NumPy docstring style.
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 1.19 โ€บ dev โ€บ style_guide.html
NumPy C Style Guide โ€” NumPy v1.19 Manual
June 29, 2020 - Function and macro call style: foo(a, b, c), no space before the open paren, no spaces inside the parens, no spaces before commas, one space after each comma.
๐ŸŒ
Plain English
python.plainenglish.io โ€บ how-to-write-numpy-style-docstrings-a092121403ba
How to Write NumPy-Style Docstrings | Python in Plain English
May 25, 2022 - Three main styles have evolved: the traditional style, the Google style, and the NumPy style. I advocate the NumPy style because it is very human-readable (in contrast to the traditional style) and it is widely used in the scientific and technical community, which is my own domain.
Find elsewhere
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 1.19 โ€บ docs โ€บ howto_document.html
A Guide to NumPy/SciPy Documentation โ€” NumPy v1.19 Manual
Some features described in this document require a recent version of numpydoc. For example, the Yields section was added in numpydoc 0.6. We mostly follow the standard Python style conventions as described here:
Top answer
1 of 2
13

Summary

The **kwargs are not typically listed in the function, but instead the final destination of the **kwargs is mentioned. For example:

**kwargs
    Instructions on how to decorate your plots.
    The keyword arguments are passed to `matplotlib.axes.Axes.plot()` 
  • If there are multiple possible targets, they are all listed (see below)
  • If you happen to use some automation tool to interpolate and link your documentation, then you might list the possible keyword arguments in **kwargs for the convenience of the end users. This kind of approach is used in matplotlib, for example. (see below)

How and when document **kwargs (Numpydoc)

1) When to use **kwargs?

First thing to note here is that **kwargs should be used to pass arguments to underlying functions and methods. If the argument inside **kwargs would be used in the function (and not passed down), it should be written out as normal keyword argument, instead.

2) Where to put **kwargs decription?

The location of **kwargs description is in the Parameters section. Sometimes it is appropriate to list them in the Other Parameters section, but remember: Other Parameters should only be used if a function has a large number of keyword parameters, to prevent cluttering the Parameters section.

  • matplotlib.axes.Axes.grid has **kwargs in Parameters section.
  • matplotlib.axes.Axes.plot has **kwargs in Other Parameters section (reasoning probably to large number of keyword arguments).

3) Syntax for **kwargs decription

The syntax for the description for the **kwargs is, following Numpydoc styleguide

Parameters
----------
... (other lines)
**kwargs : sometype
     Some description on what the kwargs are
     used for.

or

Parameters
----------
... (other lines)
**kwargs
     Some description on what the kwargs are
     used for.

The one describing the type is more appropriate, as [source].

For the parameter types, be as precise as possible

One exception for this is for example when the **kwargs could be passed to one of many functions based on other parameter values, as in seaborn.kdeplot. Then, the line for the type would become too long for describing all the types and it would be cleaner to use a bullet point list, which also describes the conditions on when the **kwargs are forwarded to where. Eg.:

Parameters
----------
fill: bool or None
    If True, fill in the area under univariate density curves or between 
     bivariate contours. If None, the default depends on multiple.
**kwargs
    Other keyword arguments are passed to one of the following matplotlib 
    functions:

    * matplotlib.axes.Axes.plot() (univariate, fill=False),

    * matplotlib.axes.Axes.fill_between() (univariate, fill=True),

    * matplotlib.axes.Axes.contour() (bivariate, fill=False),

    * matplotlib.axes.contourf() (bivariate, fill=True).

You may also add listing of the valid keyword arguments in **kwargs like in matplotlib.axes.Axes.grid. Here is the interpolated python doc/text version:

Parameters
----------
... (other lines)
**kwargs : `.Line2D` properties
    Define the line properties of the grid, e.g.::

        grid(color='r', linestyle='-', linewidth=2)

    Valid keyword arguments are:

    Properties:
    agg_filter: a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
    alpha: float or None
    animated: bool
    antialiased or aa: bool
    clip_box: `.Bbox`
    clip_on: bool
    clip_path: Patch or (Path, Transform) or None
    color or c: color
    contains: unknown
    dash_capstyle: {'butt', 'round', 'projecting'}
    dash_joinstyle: {'miter', '
    ... (more lines)

This is convenient for the user, but challenging for the developer. In matplotlib this kind of luxury is made possible with the automatization using some special documentation decorators and linking1. Manual writing of allowed kwargs will surely become a code maintenance nightmare.

4) Notes related to **kwargs / Extended help

Some additional info about the **kwargs could be included in the Notes section. For example matplotlib.axes.Axes.plot discusses marker styles, line styles and colors in the Notes section. [2]


[1] They use a @docstring.dedent_interpd decorator which pulls the meaning of the kwargs to the final docs. So that is happening in place of %(Line2D:kwdoc)s, for example.
[2] See: help(ax.plot) where ax is instance of matplotlib.axes.Axes.

2 of 2
6

Usually kwargs that need to be described in the Parameters section would typically be handled like other named arguments and the **kwargs is left unexpanded. However, the numpy style guide also has an Other Parameters section than can be used for providing descriptions of kwargs without cluttering the Parameters section. The style guide describes it as:

An optional section used to describe infrequently used parameters. It should only be used if a function has a large number of keyword parameters, to prevent cluttering the Parameters section.

The numpydoc repo gives this example:

"""

    Other Parameters
    ----------------
    only_seldom_used_keyword : int, optional
        Infrequently used parameters can be described under this optional
        section to prevent cluttering the Parameters section.
    **kwargs : dict
        Other infrequently used keyword arguments. Note that all keyword
        arguments appearing after the first parameter specified under the
        Other Parameters section, should also be described under this
        section.

"""

So, the additional kwargs could be added as

"""

    Other Parameters
    ----------------
    first_kwarg: int
        This is an integer
    second_kwarg: str
        This is a string
    **kwargs : dict
        Other infrequently used keyword arguments.

"""
๐ŸŒ
Pyansys
dev.docs.pyansys.com โ€บ doc-style โ€บ docstrings.html
Numpydoc docstrings โ€” PyAnsys developer's guide
While the numpydoc style guide says to surround the names of classes, methods, and variables in a single backtick, you must use double backticks.
๐ŸŒ
Lsst
developer.lsst.io โ€บ python โ€บ numpydoc.html
Documenting Python APIs with docstrings โ€” LSST DM Developer Guide main documentation
We organize Python docstrings into sections that appear in a common order. This format is based on the original Numpydoc Style Guide (used by NumPy, SciPy, and Astropy, among other scientific Python packages), though this style guide includes several DM-specific clarifications.
๐ŸŒ
NumPy
numpy.org โ€บ doc โ€บ 1.21 โ€บ docs โ€บ howto_document.html
A Guide to NumPy Documentation โ€” NumPy v1.21 Manual
June 22, 2021 - In general, we follow the Google developer documentation style guide. ... We pluralize index as indices rather than indexes, following the precedent of numpy.indices.
๐ŸŒ
NumPy
numpy.org โ€บ devdocs โ€บ dev โ€บ howto-docs.html
How to contribute to the NumPy documentation โ€” NumPy v2.5.dev0 Manual
Grammatical issues inadequately addressed by the NumPy or Google rules are decided by the section on โ€œGrammar and Usageโ€ in the most recent edition of the Chicago Manual of Style.
๐ŸŒ
Everdone
everdone.ai โ€บ whats-new โ€บ guides-resources โ€บ The-Complete-Guide-for-Google-NumPy-and-Sphinx-Styles
The Complete Guide (Google, NumPy, and Sphinx Styles)
March 18, 2026 - Python has three mainstream docstring formats and no clear winner. Here's when to use Google style, NumPy style, and Sphinx style โ€” with complete templates, real examples, and the tooling that enforces each one.
๐ŸŒ
pythontutorials
pythontutorials.net โ€บ blog โ€บ numpy-style-docstrings
Mastering NumPy Style Docstrings: A Comprehensive Guide โ€” pythontutorials.net
NumPy style docstrings are a specific convention for writing docstrings that have become widely adopted in the scientific Python community. They offer a structured and detailed format for documenting code, which is especially useful for complex ...
๐ŸŒ
Sphinx
sphinx-doc.org โ€บ en โ€บ master โ€บ usage โ€บ extensions โ€บ napoleon.html
sphinx.ext.napoleon โ€“ Support for NumPy and Google style docstrings โ€” Sphinx documentation
Compare the jumble above to the same thing rewritten according to the Google Python Style Guide: Args: path (str): The path of the file to wrap field_storage (FileStorage): The :class:`FileStorage` instance to wrap temporary (bool): Whether or not to delete the file when the File instance is destructed Returns: BufferedFileStorage: A buffered writable file descriptor ... Napoleon is a extension that enables Sphinx to parse both NumPy and Google style docstrings - the style recommended by Khan Academy.