Skip to main content

LLM-powered documentation tool

Project description

lovethedocs

Make every docstring sparkle.

Why?

  • One‑command upgrades – run lovethedocs update path/, review, merge.
  • Consistent NumPy‑style docstrings everywhere – Google and reST next.
  • Scales with -c/--concurrency – fire off many model requests in parallel.
  • Non‑destructive – edits live in path/.lovethedocs/ until you accept them.

Quick start

pip install lovethedocs        # install
export OPENAI_API_KEY=sk-...   # authenticate
lovethedocs update path/       # stage edits
lovethedocs review path/       # open diffs in your viewer
lovethedocs clean path/        # wipe staged edits

# Stage + review in one go (8 parallel requests)
lovethedocs update -r -c 8 path/

Or put the key in a .env file at your project root:

echo "OPENAI_API_KEY=sk-..." > .env

🎯 Example

Before:

def process_data(data, threshold):
    # Process data according to threshold
    result = []
    for item in data:
        if item > threshold:
            result.append(item * 2)
    return result

After:

def process_data(data: list, threshold: float) -> list:
    """
    Filter and transform data based on a threshold value.

    Parameters
    ----------
    data : list
        The input data list to process.
    threshold : float
        Values above this threshold will be processed.

    Returns
    -------
    list
        A new list containing doubled values of items that exceeded the threshold.
    """
    result = []
    for item in data:
        if item > threshold:
            result.append(item * 2)
    return result

🔧 Usage

Generate, review, and clean up staged files. Use -c/--concurrency N to set parallel request count (default 0).

Generate Documentation

# Update docs for a single file
lovethedocs update path/to/your/file.py

# Update docs and review for an entire directory
lovethedocs update -r path/to/your/project/

# Speed up large projects with more workers
lovethedocs update -c 16 path/to/your/project/ 

Review staged edits

lovethedocs tries diff viewers in this order:

  1. IDEs launched with the code command (VS Code)
  2. git (git diff --no-index)
  3. Colourised terminal diff
lovethedocs review path/

Override with -v/--viewer:

# Use Git’s difftool
lovethedocs review -v git path/

# Stage and review. Force output to terminal
lovethedocs update -r -v terminal path/ 

All new files are staged in a .lovethedocs/staged/ directory within your project. For example, if you run lovethedocs update path/, the updated versions will be stored in path/.lovethedocs/staged/. When you accept changes during review, original files are backed up to path/.lovethedocs/backups/.

Clean up

lovethedocs clean path/

🔍 How It Works

LoveTheDocs:

  1. Analyzes your Python codebase with LibCST.
  2. Extracts function and class information.
  3. Uses LLMs to generate docstrings in NumPy style (Google and reST next).
  4. Updates your code with LLM generated documentation.
  5. Presents changes for your review and approval.

The process is non-destructive - you maintain complete control over which changes to accept.

🛣️ Development Roadmap

Currently Working On

  • Latency: Asynchronous model requests
  • UX: Smaller diffs and more diff reviewers
  • Style: More doc styles (Google, reStructuredText)
  • Providers: More model providers (Google, Anthropic, etc.)
  • Error handling: Improved CLI interface with better error handling

Future Plans

  • LLM optimized docs: Give context with the fewest tokens.
  • Automation: Integration with common CI/CD pipelines
  • Metrics: Quality metrics and evals.

🧰 Technical Details

Under the hood, LoveTheDocs uses:

  • A clean domain-driven architecture
  • LibCST for reliable code analysis (no regex parsing!)
  • LLM-generated docs with a system prompt for each doc style.

👥 Contributing

Contributions are welcome! The project is in its early stages, and we're still figuring out the contribution process. If you're interested:

  • Open an issue to discuss ideas or report bugs.
  • Submit pull requests for small fixes.
  • Open up an issue for larger features.

📄 License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

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

lovethedocs-0.2.0.tar.gz (27.1 kB view details)

Uploaded Source

Built Distribution

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

lovethedocs-0.2.0-py3-none-any.whl (33.8 kB view details)

Uploaded Python 3

File details

Details for the file lovethedocs-0.2.0.tar.gz.

File metadata

  • Download URL: lovethedocs-0.2.0.tar.gz
  • Upload date:
  • Size: 27.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for lovethedocs-0.2.0.tar.gz
Algorithm Hash digest
SHA256 bfbbab3f5fa31c94589da863cbb7e4f2ad2f930d26954fe52bf40b845a0a084f
MD5 8abab396451dcc2c01f8b93c4c42e35e
BLAKE2b-256 27024195de10548fcc8605a5a28cdff327889c65e4a0ddaff6ff7f8ef7812df4

See more details on using hashes here.

File details

Details for the file lovethedocs-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: lovethedocs-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 33.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for lovethedocs-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4caaa76c7283425774dafc59b5df67e6400af9e5e43031277031c46c52d13600
MD5 c881f05588f589ec94ced696f53dd18e
BLAKE2b-256 cc293df656396f237020990c4cc110cc4bfe0416114fd35146811333952a884f

See more details on using hashes here.

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