Karthik.P
Back to projects
PythonLangGraphlibcstLLM

docspatch

AI documentation for Python projects. It writes Google-style docstrings and directory-scoped READMEs, then edits them straight into your source without touching the surrounding code.

manifest.py
+8 docstring
def file_hash(path):
+ """Return a SHA-256 hash of a file's contents.
+
+ Args:
+ path: File to hash.
+
+ Returns:
+ Hex digest used to detect changes.
+ """
return sha256(path.read_bytes()).hexdigest()
$

Installation

Clone the repo and run it with uv.

from source
$ git clone https://github.com/grimmy-dev/docspatch_v2.git
$ cd docspatch_v2
$ uv sync
$ uv run dp --help

Requires Python ≥ 3.14 and an API key for one provider (Anthropic, OpenAI, or Google Gemini).

Usage

Four commands cover the whole flow.

dp
$ dp init # one-time setup
$ dp docs src/ # generate and review docstrings
$ dp readme # draft or refresh the root README
$ dp check # report stale docs/README

What it does

Docstrings

Google-style docstrings for undocumented functions, methods, classes, and modules.

READMEs

Draft or refresh a README scoped to any directory, with side-by-side diff review.

Semantic tracking

A content-hash manifest skips files that haven't changed since the last run.

Pre-commit ready

dp check reports stale items with no model calls and no configuration.

Resumable

Interrupted runs checkpoint to SQLite and continue with --resume.

Cost-aware

Reports token usage and the actual dollar cost per run, across three providers.