docstring_parser

Parse Python docstrings in ReST, Google, Numpydoc, and Epydoc styles

Library
PyPI
v0.18.0
273stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
44/100Fair
Development Activity28
Maintenance4
Community64
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
77/100Good
Architecture78
Code Quality76
Innovation70
Learning Curve85

docstring_parser parses Python docstrings written in any of the four major community conventions — ReST/Sphinx, Google-style, Numpydoc, and Epydoc — into a single unified Docstring object, regardless of which style the original author used. The parsed result exposes structured access to the short and long descriptions, parameters (with types and descriptions), return values, raised exceptions, and other docstring metadata as typed Python objects rather than raw strings.

This normalization is what makes it valuable to documentation generators, IDE tooling, and schema-generation libraries: instead of writing separate parsers for each docstring convention a codebase might use, consumers call parse() once and get a consistent object model back, with auto-detection of which style a given docstring uses.

What You Get

  • A single parse() function that auto-detects and parses ReST, Google, Numpydoc, and Epydoc docstring styles
  • A unified Docstring object exposing short_description, long_description, params, returns, and raises as typed attributes
  • Per-format parser modules (rest.py, google.py, numpydoc.py, epydoc.py) usable directly when the format is already known
  • An attrdoc module for parsing attribute-level docstrings on class fields
  • Full type hints (py.typed marker) for editor and static-analysis support

Common Use Cases

  • Extracting parameter types and descriptions from docstrings to auto-generate JSON schemas or CLI help text
  • Building documentation generators that need a normalized model regardless of the source docstring convention
  • Powering IDE/language-server features like parameter hints derived from docstring content
  • Feeding structured function/parameter descriptions into other tools (e.g. schema or code generators) from existing docstrings

Under The Hood

Architecturedocstring_parser/parser.py implements format auto-detection and dispatches to the appropriate style-specific parser; each of rest.py, google.py, numpydoc.py, and epydoc.py implements its own tokenizer/parser tailored to that convention’s section syntax, but all normalize their output into the shared data classes defined in common.py (Docstring, DocstringParam, DocstringReturns, DocstringRaises, etc.). attrdoc.py layers attribute-docstring extraction (using the AST module) on top of the same common model, and util.py provides shared helpers like description-combining logic.

Tech Stack — Pure Python with zero runtime dependencies beyond the standard library, using dataclasses/typed classes for its result model and Python’s ast module for attribute-docstring extraction. Packaged with a py.typed marker for full static-typing support in consumers.

Code Quality — The project maintains a GitHub Actions build pipeline (badge in the README) running its test suite, and the codebase is organized with one file per docstring style, keeping each parser’s grammar isolated and independently testable. Development is currently maintenance-mode (moderate commit frequency, infrequent releases per the health-score data) but the project has a decade of production use across major Python doc-tooling.

API Design — A single top-level parse() call is the entire API surface most users need, immediately returning a typed object with attribute access (docstring.params[1].arg_name) rather than requiring users to walk a raw AST or dictionary. The README leads directly with a runnable REPL example demonstrating this, keeping the learning curve minimal for the common case while the per-format modules remain available for advanced, format-specific use.

Used by 6 apps in this directory

Python
66%
Apache 2.0

Agent Control

AI Agents

304

An open-source runtime control plane for AI agents — define safety guardrails once, apply them across agents built on LangChain, CrewAI, Google ADK, or AWS Strands, and update controls without redeploying code.

View details
75
Repo Health
71
Technical
70
Dependency
Built with
Python66%
TypeScript33%
Updated 6 days ago
Python
100%
Apache 2.0

Agno

Devops · AI Development · Automation

42,074

Build, run, and manage agent platforms with a full production stack — SDK, runtime, and control plane included.

View details
93
Repo Health
87
Technical
66
Dependency
Built with
Python100%
Updated yesterday
Python
100%
Apache 2.0

ClearML

Devops · Automation

6,858

Auto-magical MLOps platform that tracks experiments, versions data, orchestrates pipelines, and serves models with just two lines of code.

View details
95
Repo Health
79
Technical
67
Dependency
Built with
Python100%
Updated yesterday
Python
64%
Other

Keep

Devops · Automation · Monitoring

12,290

The open-source AIOps and alert management platform that unifies 130+ monitoring tools into a single pane of glass with AI-powered correlation, deduplication, and workflow automation.

View details
91
Repo Health
79
Technical
66
Dependency
Built with
Python64%
TypeScript36%
Updated yesterday
Python
68%
MIT

Langflow

AI Agents · AI Development

154,349

Build, test, and deploy AI agents and RAG workflows visually with native API and MCP server export.

View details
90
Repo Health
85
Technical
65
Dependency
Built with
Python68%
TypeScript23%
Updated today
Python
61%
Apache 2.0

marimo

Developer Tools · Data Engineering

22,670

A reactive Python notebook that eliminates hidden state, runs reproducibly, and deploys as a web app or script — stored as pure Python, built for the AI era.

View details
90
Repo Health
91
Technical
65
Dependency
Built with
Python61%
TypeScript37%
Updated yesterday

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search