Skip to main content

AI-powered docstring generator for Python codebases. Batch-generates Google, NumPy, or Sphinx docstrings. Preserves existing docs. CI-ready.

Project description

docstring-ai

AI-powered docstring generator for Python codebases. Batch-generates Google, NumPy, or Sphinx docstrings. Preserves existing docs. CI-ready.

Tests Python License LinkedIn

Install

pip install docstring-ai

Requires ANTHROPIC_API_KEY.

Quick start

from docstring_ai import DocstringAI

ai = DocstringAI(style="google")

# Single function
result = ai.generate_for_source("""
def compute_recall(retrieved: list, relevant: list, k: int = 5) -> float:
    hits = sum(1 for r in retrieved[:k] if r in relevant)
    return hits / len(relevant) if relevant else 0.0
""")
print(result.docstring)

# Entire file
report = ai.process_file("mymodule.py", dry_run=True)
print(report.summary())
# Generated:    8 / Already had: 3 / Skipped: 2

# Entire directory
reports = ai.process_directory("src/", pattern="*.py")

Styles

DocstringAI(style="google")   # Google (default)
DocstringAI(style="numpy")    # NumPy
DocstringAI(style="sphinx")   # Sphinx / reST

CLI

docstring-ai src/mymodule.py --dry-run
docstring-ai src/ --style numpy
docstring-ai src/ --overwrite --include-private

Linda Oraegbunam | LinkedIn | GitHub

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

docstring_ai-1.0.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

docstring_ai-1.0.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file docstring_ai-1.0.0.tar.gz.

File metadata

  • Download URL: docstring_ai-1.0.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for docstring_ai-1.0.0.tar.gz
Algorithm Hash digest
SHA256 56c17a76324ccc9fbcd1f8e617e1d7189b12aa90ff558dcf6cbaaebd288f7b09
MD5 3f5a0080727f7672584eeccaaf7f60cd
BLAKE2b-256 f1ce77223de9782162a938fd231a78dc510f36d33b56546bb1f7fd2a427669bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for docstring_ai-1.0.0.tar.gz:

Publisher: publish.yml on obielin/docstring-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file docstring_ai-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: docstring_ai-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for docstring_ai-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6570099cc1faa886d5cff96312edd22959f71d57693f78ac58ef32cef61794a0
MD5 8c541187f9359477a06427bcf609b328
BLAKE2b-256 6a752aa6786f9a9434d74ce6640696cf45e41d9f1e01419bc2c3d0ee95e006e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for docstring_ai-1.0.0-py3-none-any.whl:

Publisher: publish.yml on obielin/docstring-ai

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page