docstring-parser

0.17.0 · active · verified Sat Mar 28

A Python library for parsing docstrings in reST, Google, and Numpydoc formats. Current version: 0.17.0, released on July 21, 2025. Maintained with a stable release cadence.

Warnings

Install

Imports

Quickstart

A quickstart guide demonstrating how to parse a sample docstring using the 'parse' function from docstring_parser.

from docstring_parser import parse

# Sample docstring
docstring = """
This is a sample function.

:param x: The input value
:type x: int
:return: The squared value of x
:rtype: int
"""

# Parse the docstring
parsed = parse(docstring)

# Access parsed components
print(f"Description: {parsed.short_description}")
print(f"Parameters: {parsed.params}")
print(f"Returns: {parsed.returns}")

view raw JSON →