Catalog PyPI
Back to packageRELEASE DETAILS

1.0.1

PyPI

ai-doc-generator

AI-powered documentation generator for Python projects using OpenAI

aiautomationdocumentationgptopenaipython
Published20 Jul 2025
Direct dependencies12
Transitive dependenciesNot calculated

README

Version 1.0.1 documentation

AI Documentation Generator 🤖📚

PyPI version Python Support License: MIT Tests codecov

Automatically generate comprehensive documentation for your Python projects using OpenAI's GPT models. This tool analyzes your codebase and creates detailed, well-structured documentation that helps developers understand and use your code effectively.

✨ Features

  • 🔍 Intelligent Code Analysis: Uses AST parsing to understand your code structure
  • 📝 Comprehensive Documentation: Generates detailed docs for modules, classes, functions, and more
  • 🚀 Incremental Updates: Only regenerates docs for files that have changed
  • 🔧 Git Integration: Tracks changes through git history
  • 💰 Cost-Effective: Minimal API usage through smart caching and incremental updates
  • 🎨 Beautiful Output: Generates well-structured Markdown documentation
  • ⚙️ Highly Configurable: Customize what gets documented and how
  • 🖥️ CLI & API: Use as a command-line tool or integrate into your Python projects

📦 Installation

pip install ai-doc-generator

Or install from source:

git clone https://github.com/haseebrj17/ai-doc-generator.git
cd ai-doc-generator
pip install -e .

🚀 Quick Start

  1. Set your OpenAI API key:
export OPENAI_API_KEY="your-api-key-here"
  1. Generate documentation for your project:
ai-doc-gen /path/to/your/project

That's it! Your documentation will be generated in docs/generated/.

📖 Usage

Command Line Interface

# Generate docs for current directory
ai-doc-gen

# Generate docs for specific path
ai-doc-gen /path/to/project

# Force full regeneration (ignore cache)
ai-doc-gen --full

# Use a specific model
ai-doc-gen --model gpt-4o-mini

# Custom output directory
ai-doc-gen --output docs/api

# Include test files
ai-doc-gen --include-tests

# Dry run to see what would be documented
ai-doc-gen --dry-run

Python API

from ai_doc_generator import Config, DocumentationGenerator

# Create configuration
config = Config(
    project_root="./my_project",
    output_dir="./docs",
    include_tests=False,
    model="gpt-4o"
)

# Generate documentation
generator = DocumentationGenerator(config)
generator.generate_documentation()

⚙️ Configuration

Create a ai-doc-config.json file in your project root:

{
  "model": "gpt-4o",
  "output_dir": "docs/generated",
  "include_patterns": ["*.py"],
  "exclude_dirs": ["tests", "__pycache__", ".venv"],
  "exclude_files": ["setup.py"],
  "max_file_size": 100000,
  "include_tests": false
}

💸 Cost Estimation

For a typical Python project:

  • Small project (10k lines): ~$2-3
  • Medium project (50k lines): ~$8-12
  • Large project (100k lines): ~$15-25

After initial generation, incremental updates cost 90% less!

📁 Output Structure

docs/generated/
├── README.md                 # Main documentation index
├── project-overview.md       # High-level project analysis
├── api-reference.md         # Complete API reference
├── modules/                 # Module-specific documentation
│   ├── core/
│   ├── utils/
│   └── ...
└── documentation.json       # Raw documentation data

🛠️ Advanced Features

Incremental Documentation

Only regenerate documentation for files that have changed:

# First run - documents everything
ai-doc-gen

# Subsequent runs - only changed files
ai-doc-gen

Custom Prompts

Customize the documentation style:

config = Config(
    system_prompt="Generate concise API documentation focusing on usage examples..."
)

Multiple Models

Use different models for different purposes:

  • gpt-4o: Best quality, detailed documentation
  • gpt-4o-mini: Faster and cheaper, good for most projects
  • gpt-4-turbo-preview: Balance of quality and cost

🧪 Development

# Clone the repository
git clone https://github.com/haseebrj17/ai-doc-generator.git
cd ai-doc-generator

# Install development dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run linting
black .
flake8 .
mypy .

# Run tests with coverage
pytest --cov=ai_doc_generator

📚 Documentation

The project documentation is available at: https://haseebrj17.github.io/ai-doc-generator/

Setting up GitHub Pages

  1. Go to Settings → Pages in your GitHub repository
  2. Under "Build and deployment", select "Deploy from a branch"
  3. Choose gh-pages branch and / (root) folder
  4. Click Save

🚀 Publishing to PyPI

This project has automated publishing workflows:

Automatic Publishing

When you push changes to main with an updated version in pyproject.toml, the package will automatically be published to PyPI if all tests pass.

Manual Publishing

  1. Create a new tag: git tag v1.0.1 && git push origin v1.0.1
  2. The workflow will automatically publish to PyPI

Setting up PyPI Tokens

  1. Create an account on PyPI
  2. Generate an API token from your account settings
  3. Add the token as PYPI_API_TOKEN in your repository secrets (Settings → Secrets → Actions)
  4. Optionally, add TEST_PYPI_API_TOKEN for test releases

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

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

🙏 Acknowledgments

  • OpenAI for providing the GPT models
  • The Python AST module for code analysis
  • All contributors and users of this project

📞 Support


Made with ❤️ by Muhammad Haseeb

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 12

Native requirements
12 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
openai
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
openai>=1.0.0runtime
tqdm
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
tqdm>=4.65.0runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pytest>=7.0.0; extra == "dev"runtime
pytest-cov
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pytest-cov>=4.0.0; extra == "dev"runtime
pytest-mock
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pytest-mock>=3.10.0; extra == "dev"runtime
black
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
black>=22.0.0; extra == "dev"runtime
flake8
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
flake8>=6.0.0; extra == "dev"runtime
mypy
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
mypy>=1.0.0; extra == "dev"runtime
pre-commit
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
pre-commit>=3.0.0; extra == "dev"runtime
sphinx
Environment
{
  "extras": "",
  "marker": "extra == \"docs\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
sphinx>=5.0.0; extra == "docs"runtime
sphinx-rtd-theme
Environment
{
  "extras": "",
  "marker": "extra == \"docs\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
sphinx-rtd-theme>=1.0.0; extra == "docs"runtime
myst-parser
Environment
{
  "extras": "",
  "marker": "extra == \"docs\"",
  "requires_python": ">=3.8",
  "evaluation": "NOT_EVALUATED"
}
myst-parser>=0.18.0; extra == "docs"runtime

Distribution files

2 collected
ai_doc_generator-1.0.1-py3-none-any.whl

bdist_wheel · 24.12 KB · Python py3

Source file
ai_doc_generator-1.0.1.tar.gz

sdist · 41.58 KB · Python source

Source file

Repository

PENDING
haseebrj17/ai-doc-generator

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 10:32 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:72b09d199dd0520f0c46c48359bd0b8ea46d7d712834ed4597aa016ee1e3bd78

Other collected versions

View all collected versions →