Skip to main content

docparity

Detects drift between a function's docstring parameters and its real signature -- the classic case of renaming or removing a parameter and forgetting to update the docstring, so the documentation quietly lies to the next reader (or to an LLM/IDE that trusts it).

Supports Google, NumPy, and Sphinx (:param:) docstring styles. Zero runtime dependencies, pure ast-based static analysis.

Why

Docstrings drift silently:

def charge_card(amount, currency):
    """Charge a card.

    Args:
        amount (float): the amount to charge
        card_token (str): the card token to charge   # <- renamed to `currency`, doc never updated
    """

Nothing catches this today. Type checkers don't read docstrings. Linters that check docstring presence (pydocstyle, flake8-docstrings) don't check that documented parameter names still match the signature. The result is stale documentation that misleads humans, and misleads LLM coding assistants and IDEs that surface docstrings as ground truth.

Install

pip install docparity

Usage

docparity src/                 # scan a directory recursively
docparity mymodule.py          # scan a single file
docparity --stale-only src/    # only report renamed/removed params, not missing docs

Exit codes: 0 clean, 1 findings reported, 2 usage/syntax error.

What it checks (v0.1)

  1. Stale documented parameter -- the docstring documents a parameter name that no longer exists in the real signature (renamed or removed).
  2. Missing documentation for a real parameter -- the function already has a params section, and a real parameter isn't in it (added to the signature, forgotten in the docs).

docparity only checks functions that already document at least one parameter. It never asks you to add documentation to an undocumented function -- that's a coverage tool's job, not a drift tool's job. This keeps false positives near zero.

Library usage

from docparity import scan_file

findings = scan_file("mymodule.py")
for f in findings:
    print(f)

See docs/USAGE.md for more, and DETAILS.md for design rationale and scope boundaries.

License

MIT

Metadata

Release files for docparity 0.1.0

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

Source distribution (sdist)

Source distribution for docparity 0.1.0
File Size Uploaded Provenance
docparity-0.1.0.tar.gz 9.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for docparity 0.1.0
File Interpreter ABI Platform
docparity-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.8 kB

Release files / docparity-0.1.0.tar.gz

Download URL docparity-0.1.0.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
40b8f35c1094a2e5a05088733b62ab5737cceecd483945c26bb5dd83976ec6c4
BLAKE2b-256 checksum
How to use checksums
21175fe334ce331e132245a6fb6d15eadfab0811f2374bf2874e630d5096545a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Release files / docparity-0.1.0-py3-none-any.whl

Download URL docparity-0.1.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4401e4f0e29e3329f13be347e86aba037549f982bd1c23171b4901d718a73682
BLAKE2b-256 checksum
How to use checksums
69c5eb978500bffd0e275a21d744b898238393e49d784328e4f0ae1bee40fab5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.12

Security for docparity 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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