Skip to main content

AutoDoc AI

PyPI version License: MIT

AutoDoc AI is a smart command-line developer tool that automates the tedious parts of maintaining high-quality Python code. It leverages Large Language Models (LLMs) to automatically generate docstrings, suggest intelligent refactorings, and integrate seamlessly into a modern development workflow.

This project was built on a foundation of solid Object-Oriented Programming principles and design patterns, including the Visitor, Strategy, Factory, and Adapter patterns.


Core Features

  • AI-Powered Docstring Generation: Automatically create high-quality, context-aware docstrings for any function or class that's missing them.
  • Intelligent Docstring Correction: Uses AI to evaluate existing docstrings and replaces poor-quality or placeholder documentation with new, improved versions.
  • AI-Powered Refactoring:
    • Safe Variable Renaming: Automatically renames poorly named local variables within function scope.
    • Intelligent Naming Suggestions: Acts as an AI-powered linter, suggesting better names for classes and functions.
  • Seamless Git Integration: Use the --diff flag to only process files that have been changed in your current Git branch.
  • Codebase-Wide Scanning: Run autodoc on a single file or an entire directory, with automatic .gitignore respect.
  • Automatic Formatting: Integrates with the black code formatter to ensure all generated and refactored code is perfectly styled.
  • Highly Configurable: Set project-wide defaults for style, AI provider, and behavior in your pyproject.toml file.

Installation

You can install AutoDoc AI directly from PyPI:

pip install autodoc-ai-paudelnirajan

First-Time Setup

Before you can use the AI features, you need to configure your API key. The easiest way is to use the built-in init command in your project's root directory.

autodoc init

This will guide you through creating or updating a .env file with your Groq API key and preferred model.

Configuration

AutoDoc uses a .env file for secrets and a pyproject.toml file for project-wide settings.

1. API Credentials (.env)

The autodoc init command will create this for you. It should look like this:

GROQ_API_KEY="gsk_YourActualGroqApiKeyHere"
GROQ_MODEL_NAME="llama3-8b-8192"

2. Project Defaults (pyproject.toml)

You can set default behaviors for your project in pyproject.toml. These settings will be used unless they are overridden by a command-line flag.

# In your pyproject.toml

[tool.autodoc]
# Settings for your AutoDoc tool
strategy = "groq"
style = "google"           # 'google', 'numpy', or 'rst'
overwrite_existing = true  # Regenerate poor-quality docstrings
refactor = true            # Enable AI-powered refactoring

Usage

AutoDoc is a flexible command-line tool with two main commands: init and run.

Get a list of commands:

autodoc --help

Get detailed help for the run command and all its flags:

autodoc run --help

Run on a specific file (dry run, prints to console):

autodoc run path/to/your/file.py

Run on an entire directory and save changes in-place:

autodoc run src/ --in-place

Run in "Git mode" to only process changed files (most common use case):

autodoc run . --diff --in-place

Enable all AI features to perform a full quality pass:

autodoc run . --in-place --overwrite-existing --refactor

How It Works

AutoDoc uses a "Surgical Hybrid" architecture that combines the strengths of traditional and modern tooling:

  1. Fast Local Analysis: It uses Python's ast (Abstract Syntax Tree) module to rapidly parse code and identify potential issues.
  2. Targeted AI Intelligence: Only when a potential issue is found does it send the small, relevant code snippet to an LLM for intelligent analysis.
  3. Precise Code Modification: The AI's response is used to perform a safe and precise modification of the AST, which is then unparsed back into valid Python code.
  4. Toolchain Integration: Finally, it uses black to ensure the final code is perfectly formatted, integrating seamlessly into the existing Python ecosystem.

License

This project is licensed under the MIT License.

Metadata

Release files for autodoc-ai-paudelnirajan 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for autodoc-ai-paudelnirajan 0.1.4
File Size Uploaded Provenance Actions
autodoc_ai_paudelnirajan-0.1.4.tar.gz 14.5 kB Without provenance Details for autodoc_ai_paudelnirajan-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for autodoc-ai-paudelnirajan 0.1.4
File Interpreter ABI Platform Actions
autodoc_ai_paudelnirajan-0.1.4-py3-none-any.whl Python 3 none any Details for autodoc_ai_paudelnirajan-0.1.4-py3-none-any.whl

Total release size: 28.2 kB

Release files / autodoc_ai_paudelnirajan-0.1.4.tar.gz

Download URL autodoc_ai_paudelnirajan-0.1.4.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
e2c239affae9a655aaafb111ed26b01541be79f718947b6b0b2007a97af88cbc
BLAKE2b-256 checksum
How to use checksums
513b90e24865f3adee4b5c7b4211667df9802ee20af4009f07a7aed85163520c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / autodoc_ai_paudelnirajan-0.1.4-py3-none-any.whl

Download URL autodoc_ai_paudelnirajan-0.1.4-py3-none-any.whl
Size 13.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
db64f60d60d115b540403b22343c9c0b1de20a711a81d05aa882b0d351928426
BLAKE2b-256 checksum
How to use checksums
751a3d7fa5b502fd6d13675be56b97f43ce6d28c74017982e281d702b44d2ed7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Security for autodoc-ai-paudelnirajan 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page