Skip to main content

Docstr-Health

PyPI version Python versions License Downloads tests GitHub stars

Made by Human

CLI and CI tool for fast docstring quality checks in Python projects. Detailed statistics for functions, classes, modules, and the whole project.

Analyze documentation quality locally, from Git repositories, or from PyPI packages.

Preview

Table of Contents


Features

  • Local & remote scanning: local directories, Git repositories, and PyPI packages
  • Multi-level quality grading: each object gets bad, good, special, or epic status
  • Detailed statistics: breakdown by functions, classes, modules, and overall project
  • CI & pre-commit ready: --ci mode with configurable failure level, plus a ready-to-use pre-commit hook
  • Fast AST-based analysis: parses Python code without importing it
  • Rich terminal UI: color-coded panels, tables, and progress bars
  • Flexible configuration: tune thresholds, symbols, colors, and keywords via pyproject.toml
  • Docstring style awareness: detects common sections used by PEP 257, Google, Sphinx, and NumPy styles
  • Clickable file navigation: jump to files directly from supported terminals/IDEs

How It Compares

Feature docstr-health pydoclint darglint / darglint2 interrogate docstr_coverage
Scope Docstring quality grading Docstring correctness vs signature Docstring correctness vs signature Docstring coverage (%) Docstring coverage (%)
Quality levels ✓ bad, good, special, epic ✗ Pass/fail only ✗ Pass/fail only ✗ Percentage only ✗ Percentage only
Detailed stats ✓ Functions, classes, modules, project ✗ ✗ ✓ Coverage totals ✓ Coverage totals
Rich terminal UI ✓ Rich panels, colors, symbols ✗ Plain text ✗ Plain text ✗ ASCII table ✗ Plain text
Remote scanning (Git / PyPI) ✓ Built-in ✗ ✗ ✗ ✗
CI mode / exit code ✓ --ci with failure_level ✓ ✓ ✓ ✓
Pre-commit hook ✓ ✓ ✓ ✓ ✓
Configurable rules ✓ pyproject.toml ✓ CLI flags + config ✓ .darglint config ✓ pyproject.toml / setup.cfg ✓ .docstr.yaml
Performance ✓ Fast (AST-based) ✓ Fast ✗ Slow (CYK parser) ✓ Fast ✓ Fast
Docstring styles ✓ PEP 257, Google, Sphinx, NumPy ✓ Google, Sphinx, NumPy ✓ Google, Sphinx, NumPy ✗ Coverage only ✗ Coverage only
Documentation ✓ ✓ ✓ ✓ ✓
Signature validation ✗ Planned ✓ Checks args/returns/raises match code ✓ Checks args/returns/raises match code ✗ ✗
Coverage badge generation ✗ Planned ✗ ✗ ✓ SVG/PNG ✓ SVG

When to use docstr-health

  • You want to measure documentation depth, not just its existence
  • You want a quick visual health score for your project's documentation
  • You need to scan remote repositories (Git, PyPI) without cloning manually
  • You want color-coded terminal output with rich formatting
  • You want to enforce docstring quality in CI/pre-commit with a configurable failure threshold.

Installation

pip install docstr-health

Documentation

Full documentation is available on the documentation website.


Usage

Scan a local project

docstr-health /path/to/project

If no path is given, the current directory is used.

Scan a Git repository

docstr-health --repo-url https://github.com/user/repo.git

The repository is cloned into a cache directory and scanned automatically.

Scan a PyPI package

docstr-health --pypi-package requests

Downloads and scans the package from PyPI.

Use in CI / pre-commit

docstr-health --ci --threshold-warning 60
repos:
  - repo: https://github.com/PurpleSwtr/docstr-health
    rev: v0.1.5
    hooks:
      - id: docstr-health

Compact mode

Display only the summary statistics without the per-function listing:

docstr-health --compact

Include module docstrings

Include __doc__ of the modules themselves in the analysis:

docstr-health --doc-modules

All flags

Flag Description
--repo-url Scan a remote Git repository
--pypi-package Scan a remote PyPI package
--cache-dir Custom cache directory for remote repos
--no-cache Do not cache remote repositories
--compact Show only summary statistics
--doc-modules Include module __doc__ strings
--ignore-tests Skip test files and directories
--short-names Replace full file paths with short names
--ci CI mode: suppress output, exit 1 if status ≤ failure_level
--threshold-bad Threshold for bad status (default: 80)
--threshold-warning Threshold for warning status (default: 60)
--threshold-special Threshold for special status (default: 50)
--threshold-epic Threshold for epic status (default: 50)
--version Show version and exit

Output

Docstring statuses

Status Symbol Meaning
bad ✗ Missing or empty docstring
good ✓ Docstring exists but only has a description
special ★ Contains parameter docs (Args:,:param, Returns:, etc.)
epic ♥ Contains advanced sections (Raises:, Examples:)

Module statuses

The overall module status is computed from the individual function statuses:

  • bad: all or most functions are undocumented
  • warning: some functions are undocumented
  • good: all functions documented, few special sections
  • special: >50% of functions have parameter documentation
  • epic: >50% of functions have advanced documentation (returns, raises, examples)

Configuration

Defaults ship with the package. Override anything you need in pyproject.toml (or use CLI flags):

[tool.docstr-health]
excluded = [".venv", "__init__", "__pycache__"]
threshold_bad = 80
threshold_warning = 60

All available options and their defaults: see config.toml.

Contributing

We welcome and appreciate all contributions!

Before you begin, please read Contributing Guide. It covers coding standards, branching strategy, and the Pull Request process.

License

Apache License 2.0 © Mihail Sergeenko. See LICENSE for details.

Acknowledgements

Huge thanks to Textualize for Rich, library powering this project.

Metadata

Release files for docstr-health 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for docstr-health 0.1.5
File Size Uploaded Provenance Actions
docstr_health-0.1.5.tar.gz 19.1 kB Without provenance Details for docstr_health-0.1.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for docstr-health 0.1.5
File Interpreter ABI Platform Actions
docstr_health-0.1.5-py3-none-any.whl Python 3 none any Details for docstr_health-0.1.5-py3-none-any.whl

Total release size: 45.7 kB

Release files / docstr_health-0.1.5.tar.gz

Download URL docstr_health-0.1.5.tar.gz
Size 19.1 kB
Tags Source
SHA-256 checksum
How to use checksums
cc8a5f71b92b24e908959c8a39e5bb8efd95ef0a15dd6d1c029feb00da9bfb8c
BLAKE2b-256 checksum
How to use checksums
6f901a768e91cdd21bd12ff96979a9920ddb2665b562f2ed1657fd81cb50bdb8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.11 {"installer":{"name":"uv","version":"0.13.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / docstr_health-0.1.5-py3-none-any.whl

Download URL docstr_health-0.1.5-py3-none-any.whl
Size 26.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3b009b90ef12aca1538886678b2f5c178b9926f0e7988a49d4bb2568b5540585
BLAKE2b-256 checksum
How to use checksums
fe63c40ec283b10d27081d91dd906e86d58557a522657b8e3d7ac73b394ed9d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.11 {"installer":{"name":"uv","version":"0.13.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for docstr-health 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page