docformatter
Formats docstrings to follow PEP 257
Decision gist · record as of 2026-08-14
Yes. docformatter is actively maintained, has no known vulnerabilities, minimal dependencies, and solves a real problem in code standardization. It integrates well with existing Python tooling and is permissively licensed. Install it if your team values consistent docstring formatting or you need PEP 257 compliance automation.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later; Python < 3.11 users need the optional tomli extra to use pyproject.toml configuration.
- Low friction: pure Python wheel with a single runtime dependency (charset_normalizer).
- Active maintenance with a recent release (108 days ago) and ongoing commits.
License · maintenance · safety
Expat (permissive) — Licensed under Expat (MIT), a permissive license that allows commercial and private use with minimal restrictions. No licensing barriers to adoption.
last release 2026-04-28 (108 days) · last repo commit 2026-08-10 · 596 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,476,184 downloads/mo, #3,859 on PyPI
Alternatives
Verify before relying
pip install docformatter
# Format a file in-place
docformatter --in-place example.py
# Or use as a library
from docformatter import format_docstring
formatted = format_docstring('', '"""Original docstring."""')- Whether the package handles all Sphinx and Epytext field list styles or only a subset.
- Performance characteristics when formatting large codebases or deeply nested docstrings.
- Compatibility guarantees with other formatters beyond black when using --black mode.
What it is and what it does
docformatter is a command-line tool and library that automatically reformats Python docstrings to follow PEP 257 conventions. It enforces consistent triple-quote usage, proper line breaks between summary and description, correct placement of closing quotes, and removal of trailing whitespace. It also supports Sphinx and Epytext field list styles and can be configured to work alongside black for code formatting.
The tool is designed for developers and teams who want to standardize docstring formatting across a codebase without manual editing. It works as both a standalone CLI (with --in-place file modification) and as a library that can be integrated into linting pipelines. The package has minimal dependencies and supports current Python versions, making it straightforward to add to existing projects.
Use it for
- Enforce PEP 257 docstring standards across a team's Python codebase automatically.
- Integrate into pre-commit hooks or CI/CD pipelines to catch docstring formatting issues before merge.
- Reformat legacy codebases with inconsistent docstring styles to a uniform standard.
- Work alongside black to ensure both code and docstring formatting align with project conventions.
- Configure project-wide docstring rules via pyproject.toml for reproducible formatting.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
docformatter is actively maintained, has no known vulnerabilities, minimal dependencies, and solves a real problem in code standardization. It integrates well with existing Python tooling and is permissively licensed. Install it if your team values consistent docstring formatting or you need PEP 257 compliance automation.
Install
docformatter on PyPI
Before you install
Low friction: pure Python wheel with a single runtime dependency (charset_normalizer). Active maintenance with a recent release (108 days ago) and ongoing commits. Supports modern Python versions (3.10–3.14) and PyPy.
Requires Python 3.10 or later; Python < 3.11 users need the optional tomli extra to use pyproject.toml configuration.
License in practice
Licensed under Expat (MIT), a permissive license that allows commercial and private use with minimal restrictions. No licensing barriers to adoption.
Quickstart
pip install docformatter
# Format a file in-place
docformatter --in-place example.py
# Or use as a library
from docformatter import format_docstring
formatted = format_docstring('', '"""Original docstring."""')
Verify before relying
- Whether the package handles all Sphinx and Epytext field list styles or only a subset.
- Performance characteristics when formatting large codebases or deeply nested docstrings.
- Compatibility guarantees with other formatters beyond black when using --black mode.
Package facts
| License | Expat permissive |
| Python support | Supports the current Python release <4.0,>=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagecharset_normalizer |
| Maintenance | Actively maintained 108 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,476,184 / month, #3,859 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Environment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseLicense :: Other/Proprietary LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: ImplementationProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPy |
Evidence: docformatter-1.7.8-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “docstring formatter pep 257”
- docformatterAutomatically formats Python docstrings to comply with PEP 257…
- pydocstringformatterAutomatically formats Python docstrings to comply with PEP 8 and PEP…
- pydocstylepydocstyle is a static analysis tool that checks Python docstrings…
Give your agent the search over MCP, or paste the wish link into any chat.
More Quality Assurance packages
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
Ruff is a Python linter and code formatter written in Rust that combines linting, formatting, and code fixing into a single tool, replacing Flake8, Black, isort, and related utilities.
Pexpect spawns and controls interactive console applications by sending input and matching output patterns, automating tasks that would otherwise require manual interaction.
Black reformats Python source code to a consistent style by parsing entire files and rewriting them according to an opinionated, deterministic set of rules, eliminating manual formatting decisions.
pytest-xdist distributes pytest tests across multiple CPU cores or machines to speed up test execution, with the simplest usage being `pytest -n auto` to spawn workers equal to available CPUs.
Install it if your test suite takes long enough that parallelization would save meaningful time.
Validates AWS CloudFormation templates in YAML or JSON format against resource provider schemas and best practices, checking property values and configuration correctness.
Install it if you work with CloudFormation templates.
See also pydocstringformatter · attributes-doc · pydocstyle · flake8-docstrings · docstr-coverage · docstring-parser · flake8-quotes · numpydoc · reformat-gherkin · pylint-quotes