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.2.tar.gz (27.8 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.2-py3-none-any.whl (37.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lovethedocs-0.2.2.tar.gz
  • Upload date:
  • Size: 27.8 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.2.tar.gz
Algorithm Hash digest
SHA256 d709b36aef0fa234d6e146546ba465d1f82bc4510388bbac59f38c4fe4ecf996
MD5 0f72cac4f3b924ae6cb6cd38b4131a9b
BLAKE2b-256 578010dadb9ce38afd387454dc89f27b43772ce3de434d653e499f067b32cd3e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lovethedocs-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 37.0 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d8cc001286ec488a2825ba8d8740f319241f64e60a4ae5da61443241dfa6916d
MD5 a5493e2a759e90c9b250544f4bcaedc7
BLAKE2b-256 06a1fc9baf701f8b21a6feb50ad73370f6f71aa13fb1204d90995000e253e0f7

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