Skip to content

docstrings ¤

This module exposes objects related to docstrings.

Modules:

  • dataclasses

    This module contains the dataclasses related to docstrings.

  • google

    This module defines functions to parse Google-style docstrings into structured data.

  • numpy

    This module defines functions to parse Numpy-style docstrings into structured data.

  • parsers

    This module imports all the defined parsers.

  • sphinx

    This module defines functions to parse Sphinx docstrings into structured data.

  • utils

    This module contains utilities for docstrings parsers.

Classes:

  • Parser

    Enumeration of the different docstring parsers.

Functions:

  • parse

    Parse the docstring.

Parser ¤


          flowchart TD
          griffe.docstrings.Parser[Parser]

          

          click griffe.docstrings.Parser href "" "griffe.docstrings.Parser"
          

Enumeration of the different docstring parsers.

Attributes:

  • google

    Google-style docstrings parser.

  • numpy

    Numpydoc-style docstrings parser.

  • sphinx

    Sphinx-style docstrings parser.

google class-attribute instance-attribute ¤

google = 'google'

Google-style docstrings parser.

numpy class-attribute instance-attribute ¤

numpy = 'numpy'

Numpydoc-style docstrings parser.

sphinx class-attribute instance-attribute ¤

sphinx = 'sphinx'

Sphinx-style docstrings parser.

parse ¤

parse(
    docstring: Docstring,
    parser: (
        Literal["google", "numpy", "sphinx"] | Parser | None
    ),
    **options: Any
) -> list[DocstringSection]

Parse the docstring.

Parameters:

  • docstring (Docstring) –

    The docstring to parse.

  • parser (Literal['google', 'numpy', 'sphinx'] | Parser | None) –

    The docstring parser to use. If None, return a single text section.

  • **options (Any, default: {} ) –

    The options accepted by the parser.

Returns: