Skip to main content

LLM-powered documentation tool

Project description

LoveTheDocs

Automatically enhance your Python documentation to make your code more understandable, maintainable, and useful.

🚀 Why LoveTheDocs?

Save Developer Time and Money

  • Reduce Documentation Overhead: Generate high-quality docstrings in seconds instead of spending hours manually writing/re-writing them.
  • Cost-Effective: Improve your entire codebase's documentation for pennies (just the cost of model inference) rather than days of developer time.
  • Consistent Style: Enforce NumPy-style documentation conventions across your entire codebase automatically.

Improve Code Quality

  • Better Readability: Well-documented code is easier to understand, modify, and debug
  • Faster Onboarding: New team members can quickly grasp your codebase with clear documentation
  • Clearer Intentions: Explicit parameter types and descriptions reveal the purpose of your code

The future!

  • Better AI Integration: High-quality documentation improves how LLMs understand your code
  • Enhanced Tooling: Better docstrings improve IDE completion, type checking, and further documentation generation
  • Maintainability: Clear documentation reduces technical debt and makes future changes easier

📦 Installation

Install directly from PyPI:

pip install lovethedocs

Configure your OpenAI API key:

# Export in your shell
export OPENAI_API_KEY=your-api-key-here

# Or add to a .env file in your project root
echo "OPENAI_API_KEY=your-api-key-here" > .env

🔧 Usage

LoveTheDocs offers a simple command-line interface with two main commands:

Generate Documentation

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

# Update documentation for an entire directory
lovethedocs update path/to/your/project/

# Update multiple paths at once
lovethedocs update path/one/ path/two/ path/three/file.py

Review and Apply Changes

# Review generated documentation changes (opens in VS Code diff view)
lovethedocs review path/to/your/project/

# Generate and immediately review changes
lovethedocs update path/to/your/project/ --review

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

🔍 How It Works

LoveTheDocs:

  1. Analyzes your Python codebase with LibCST
  2. Extracts function and class information
  3. Uses LLMs to generate improved docstrings in NumPy style (more styles coming).
  4. Updates your code with enhanced documentation
  5. Presents changes for your review and approval

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

🎯 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

🛣️ Development Roadmap

Currently Working On

  • Asynchronous model requests for faster processing
  • Diff review in more editors than VS Code.
  • Support for additional documentation styles (Google, reStructuredText)
  • Multiple model provider support (Google, Anthropic, etc.)
  • Improved CLI interface with better error handling

Future Plans

  • Documentation styles specifically designed for LLM consumption
  • GitHub action for automated documentation improvements
  • Custom configuration files for fine-tuned behavior
  • Documentation quality metrics and evaluation
  • Support for package and module level documentation
  • Integration with common CI/CD pipelines

🧰 Technical Details

Under the hood, LoveTheDocs uses:

  • A clean domain-driven architecture
  • LibCST for reliable code analysis (no regex parsing!)
  • AI-generated content with specialized prompting strategies
  • Comprehensive validation to ensure correct output

👥 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.1.0.tar.gz (23.7 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.1.0-py3-none-any.whl (29.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for lovethedocs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9732b201bd73f0ac498145e423cd11328fb57459d69b46bbd5850c638a59880f
MD5 0e8677b41e91945d620b7c8ec6716a5c
BLAKE2b-256 4fdfb1955119756cc47ae398f03f3c9ada14b4bc472fc71e1e183ca17f79d09d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lovethedocs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 29.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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cfc9fb26119f1d0032d1864134dbb2c364e97521dfee60a862f652647b7712ec
MD5 73e57e85f650c048ae22d87ac53199fa
BLAKE2b-256 14370167fdc1a98100f6099027aa480b3d3da9b06c5a8c5c2282878ae21b7ca2

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