pydocstringformatter
A tool to automatically format Python docstrings that tries to follow recommendations from PEP 8 and PEP 257.
What it is and what it does
Pydocstringformatter is a command-line tool that reads Python source files and automatically reformats their docstrings to align with PEP 8 and PEP 257 style guidelines. It was created by contributors to the pylint project to address gaps in existing formatters, with a design philosophy that makes some of the more contentious PEP requirements optional rather than mandatory.
The tool handles common docstring issues: fixing quote styles, capitalizing summaries, normalizing whitespace, enforcing period terminators, and aligning multi-line docstrings. It supports multiple style guides simultaneously (e.g., pep257 and numpydoc), reads configuration from pyproject.toml, and integrates with pre-commit workflows. With zero runtime dependencies and active maintenance, it's designed as a lightweight addition to Python development toolchains.
Use it for:
- Enforce consistent docstring formatting across a team or open-source project without manual review.
- Integrate into CI/CD pipelines via pre-commit hooks to catch docstring style violations before merge.
- Reformat legacy codebases to meet modern PEP 257 standards in bulk.
- Configure project-specific docstring rules in pyproject.toml and apply them uniformly.
- Use as a linting step alongside pylint to maintain documentation quality.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Automatically formats Python docstrings to comply with PEP 8 and PEP 257 recommendations, with support for multiple style guides and configurable strictness.
Yes. The package is actively maintained, has no dependencies, requires only Python 3.11+, carries no known vulnerabilities, and solves a real problem in code quality enforcement. Install it if your team wants automated, configurable docstring formatting aligned with PEP standards.
Install
pydocstringformatter on PyPI
pip
pip install pydocstringformatteruv
uv add pydocstringformatterpoetry
poetry add pydocstringformatterInstalling pydocstringformatter
Before you install
Low friction—pure Python wheel with no runtime dependencies. Actively maintained as of 41 days ago with recent commits and a stable release cycle.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install pydocstringformatter
pydocstringformatter myfile.py
# Or with configuration in pyproject.toml:
[tool.pydocstringformatter]
write = true
style = "pep257"
Requires Python 3.11 or later.
Verify before relying
- Whether the tool can be integrated into CI/CD pipelines beyond pre-commit hooks.
- Performance characteristics when run on large codebases or projects with thousands of files.
- How the tool handles edge cases in docstrings with complex formatting or non-ASCII characters.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 41 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 172,192/month — #10,345 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pydocstringformatter-1.0.0-py3-none-any.whl
Keywords: python, docstring, format
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
docformatterAutomatically formats Python docstrings to…
permissive · top 5,000 on PyPI
flake8-docstringsIntegrates pydocstyle docstring checking into…
permissive · top 5,000 on PyPI
pydocstylepydocstyle is a static analysis tool that…
permissive · top 5,000 on PyPI
attributes-docExtracts and stores docstrings for class…
permissive · top 15,000 on PyPI
docstring-parserParses Python docstrings in ReST, Google,…
permissive · top 1,000 on PyPI
pep8Checks Python code against PEP 8 style…
permissive · top 5,000 on PyPI
docstr-coverageMeasures docstring coverage in Python source…
permissive · top 15,000 on PyPI
flake8-rst-docstringsA flake8 plugin that validates Python…
permissive · top 15,000 on PyPI
pdoc3Generates API documentation for Python 3+…
agpl · top 15,000 on PyPI
pycodestylepycodestyle checks Python code against PEP 8…
permissive · top 1,000 on PyPI