docspec-python
A parser based on lib2to3 producing docspec data from Python source code.
What it is and what it does
docspec-python is a parser that converts Python source code into structured docspec objects—a standardized format for representing module, class, function, and data documentation. It uses lib2to3 as its parsing foundation, which means it handles Python syntax reliably without requiring the Python interpreter itself. The package is typically used in documentation generation pipelines, code analysis tools, and introspection systems where you need programmatic access to Python code structure and docstrings.
The package works by reading Python source (from stdin or a file) and emitting docspec data that can be dumped, transformed, or fed into downstream tools. It depends on black for code formatting utilities, docspec for the data model, and nr-util for utility functions. The aging maintenance status (465 days since last release) suggests the core functionality is stable but may not receive rapid updates for new Python features or bug fixes.
Use it for:
- Generate structured documentation from Python source code for doc generation systems.
- Extract API metadata (classes, functions, signatures) for code analysis or IDE tooling.
- Build code introspection pipelines that need reliable Python syntax parsing without executing code.
- Feed docspec data into custom documentation renderers or static analysis tools.
- Audit or catalog Python module structure in large codebases programmatically.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses Python source code into structured docspec data, extracting module, class, function, and data documentation metadata using lib2to3.
Yes, if you need reliable Python source parsing into docspec format and can accept aging maintenance. The package has no known vulnerabilities, low install friction, and a stable core function. However, verify the unclear license status before use in proprietary contexts, and be aware that bug fixes or Python feature support may lag behind active projects.
Install
docspec-python on PyPI
pip
pip install docspec-pythonuv
uv add docspec-pythonpoetry
poetry add docspec-pythonInstalling docspec-python
Before you install
Low install friction with a pure-wheel distribution. Maintenance status is aging—last release was 465 days ago—so expect slower response to issues, though the package remains functional for its core parsing task.
License in practice
License status is unclear; no SPDX identifier or raw license text is available in the metadata. Verify the actual license terms in the repository or package source before use in proprietary or restricted contexts.
Quickstart
pip install docspec-python
from docspec_python import parse_python_module
import docspec, sys
docspec.dump_module(parse_python_module(sys.stdin, print_function=False), sys.stdout)
Requires Python 3.8 or later; depends on black, docspec, and nr-util at runtime.
Verify before relying
- Whether the unclear license status reflects a missing metadata entry or an actual licensing ambiguity in the source.
- Current repository health and maintainer responsiveness, given the 465-day gap since last release.
Package facts
| License | not declared (unclear) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — black, docspec, nr-util |
| Maintenance | aging — 465 days since the last release |
| First released | |
| Downloads | 279,366/month — #8,121 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: docspec_python-2.2.2-py3-none-any.whl
Tags
More Documentation packages
Docutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
SphinxSphinx generates professional documentation…
permissive · top 1,000 on PyPI
griffeGriffe extracts the complete structure and…
permissive · top 1,000 on PyPI
sphinxcontrib-serializinghtmlA Sphinx extension that outputs documentation…
permissive · top 1,000 on PyPI
alabasterAlabaster is a clean, responsive Sphinx theme…
permissive · top 1,000 on PyPI
sphinxcontrib-htmlhelpA Sphinx extension that generates HTML help…
permissive · top 1,000 on PyPI
docspecDocspec provides a library and CLI to…
unclear · top 15,000 on PyPI
pydoc-markdownPydoc-Markdown parses Python source code and…
permissive · top 15,000 on PyPI
colcon-python-setup-pyA colcon extension that identifies and…
permissive · top 15,000 on PyPI
comment-parserExtracts comments from source code files across…
permissive · top 15,000 on PyPI
ipsw-parserParses and extracts data from iOS IPSW firmware…
copyleft · top 15,000 on PyPI
sphinx-autodoc2sphinx-autodoc2 generates API documentation for…
permissive · top 15,000 on PyPI
pyproject-apiProvides a programmatic API to read and…
permissive · top 5,000 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
parsoParso is a Python parser that recovers from…
permissive · top 1,000 on PyPI
docx2txtExtracts text, headers, footers, hyperlinks,…
unclear · top 5,000 on PyPI