ai-doc-generator


Nameai-doc-generator JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/haseebrj17/ai-doc-generator
SummaryAI-powered documentation generator for Python projects using OpenAI
upload_time2025-07-20 11:41:21
maintainerNone
docs_urlNone
authorMuhammad Haseeb
requires_python>=3.8
licenseMIT
keywords documentation ai openai gpt automation python
VCS
bugtrack_url
requirements pytest pytest-cov pytest-mock pytest-asyncio coverage responses faker factory-boy mypy types-requests flake8 black isort setuptools openai tqdm pathlib
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # AI Documentation Generator ๐Ÿค–๐Ÿ“š

[![PyPI version](https://badge.fury.io/py/ai-doc-generator.svg)](https://badge.fury.io/py/ai-doc-generator)
[![Python Support](https://img.shields.io/pypi/pyversions/ai-doc-generator.svg)](https://pypi.org/project/ai-doc-generator/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Tests](https://github.com/haseebrj17/ai-doc-generator/workflows/tests/badge.svg)](https://github.com/haseebrj17/ai-doc-generator/actions)
[![codecov](https://codecov.io/gh/haseebrj17/ai-doc-generator/branch/main/graph/badge.svg)](https://codecov.io/gh/haseebrj17/ai-doc-generator)

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

```bash
pip install ai-doc-generator
```

Or install from source:

```bash
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:**
```bash
export OPENAI_API_KEY="your-api-key-here"
```

2. **Generate documentation for your project:**
```bash
ai-doc-gen /path/to/your/project
```

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

## ๐Ÿ“– Usage

### Command Line Interface

```bash
# 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

```python
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:

```json
{
  "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:
```bash
# First run - documents everything
ai-doc-gen

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

### Custom Prompts
Customize the documentation style:
```python
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

```bash
# 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](https://pypi.org)
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](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

- ๐Ÿ“ง Email: muhamadhaseeb2001@gmail.com
- ๐Ÿ› Issues: [GitHub Issues](https://github.com/haseebrj17/ai-doc-generator/issues)
- ๐Ÿ’ฌ Discussions: [GitHub Discussions](https://github.com/haseebrj17/ai-doc-generator/discussions)

---

**Made with โค๏ธ by [Muhammad Haseeb](https://github.com/haseebrj17)**

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/haseebrj17/ai-doc-generator",
    "name": "ai-doc-generator",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "documentation, ai, openai, gpt, automation, python",
    "author": "Muhammad Haseeb",
    "author_email": "Muhammad Haseeb <muhamadhaseeb2001@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/44/ee/edb1804d1bfa5ad664bff544e055e3912f8f226320b50f483b699d64dd51/ai_doc_generator-1.0.1.tar.gz",
    "platform": null,
    "description": "# AI Documentation Generator \ud83e\udd16\ud83d\udcda\n\n[![PyPI version](https://badge.fury.io/py/ai-doc-generator.svg)](https://badge.fury.io/py/ai-doc-generator)\n[![Python Support](https://img.shields.io/pypi/pyversions/ai-doc-generator.svg)](https://pypi.org/project/ai-doc-generator/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Tests](https://github.com/haseebrj17/ai-doc-generator/workflows/tests/badge.svg)](https://github.com/haseebrj17/ai-doc-generator/actions)\n[![codecov](https://codecov.io/gh/haseebrj17/ai-doc-generator/branch/main/graph/badge.svg)](https://codecov.io/gh/haseebrj17/ai-doc-generator)\n\nAutomatically 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.\n\n## \u2728 Features\n\n- \ud83d\udd0d **Intelligent Code Analysis**: Uses AST parsing to understand your code structure\n- \ud83d\udcdd **Comprehensive Documentation**: Generates detailed docs for modules, classes, functions, and more\n- \ud83d\ude80 **Incremental Updates**: Only regenerates docs for files that have changed\n- \ud83d\udd27 **Git Integration**: Tracks changes through git history\n- \ud83d\udcb0 **Cost-Effective**: Minimal API usage through smart caching and incremental updates\n- \ud83c\udfa8 **Beautiful Output**: Generates well-structured Markdown documentation\n- \u2699\ufe0f **Highly Configurable**: Customize what gets documented and how\n- \ud83d\udda5\ufe0f **CLI & API**: Use as a command-line tool or integrate into your Python projects\n\n## \ud83d\udce6 Installation\n\n```bash\npip install ai-doc-generator\n```\n\nOr install from source:\n\n```bash\ngit clone https://github.com/haseebrj17/ai-doc-generator.git\ncd ai-doc-generator\npip install -e .\n```\n\n## \ud83d\ude80 Quick Start\n\n1. **Set your OpenAI API key:**\n```bash\nexport OPENAI_API_KEY=\"your-api-key-here\"\n```\n\n2. **Generate documentation for your project:**\n```bash\nai-doc-gen /path/to/your/project\n```\n\nThat's it! Your documentation will be generated in `docs/generated/`.\n\n## \ud83d\udcd6 Usage\n\n### Command Line Interface\n\n```bash\n# Generate docs for current directory\nai-doc-gen\n\n# Generate docs for specific path\nai-doc-gen /path/to/project\n\n# Force full regeneration (ignore cache)\nai-doc-gen --full\n\n# Use a specific model\nai-doc-gen --model gpt-4o-mini\n\n# Custom output directory\nai-doc-gen --output docs/api\n\n# Include test files\nai-doc-gen --include-tests\n\n# Dry run to see what would be documented\nai-doc-gen --dry-run\n```\n\n### Python API\n\n```python\nfrom ai_doc_generator import Config, DocumentationGenerator\n\n# Create configuration\nconfig = Config(\n    project_root=\"./my_project\",\n    output_dir=\"./docs\",\n    include_tests=False,\n    model=\"gpt-4o\"\n)\n\n# Generate documentation\ngenerator = DocumentationGenerator(config)\ngenerator.generate_documentation()\n```\n\n## \u2699\ufe0f Configuration\n\nCreate a `ai-doc-config.json` file in your project root:\n\n```json\n{\n  \"model\": \"gpt-4o\",\n  \"output_dir\": \"docs/generated\",\n  \"include_patterns\": [\"*.py\"],\n  \"exclude_dirs\": [\"tests\", \"__pycache__\", \".venv\"],\n  \"exclude_files\": [\"setup.py\"],\n  \"max_file_size\": 100000,\n  \"include_tests\": false\n}\n```\n\n## \ud83d\udcb8 Cost Estimation\n\nFor a typical Python project:\n- **Small project** (10k lines): ~$2-3\n- **Medium project** (50k lines): ~$8-12  \n- **Large project** (100k lines): ~$15-25\n\nAfter initial generation, incremental updates cost 90% less!\n\n## \ud83d\udcc1 Output Structure\n\n```\ndocs/generated/\n\u251c\u2500\u2500 README.md                 # Main documentation index\n\u251c\u2500\u2500 project-overview.md       # High-level project analysis\n\u251c\u2500\u2500 api-reference.md         # Complete API reference\n\u251c\u2500\u2500 modules/                 # Module-specific documentation\n\u2502   \u251c\u2500\u2500 core/\n\u2502   \u251c\u2500\u2500 utils/\n\u2502   \u2514\u2500\u2500 ...\n\u2514\u2500\u2500 documentation.json       # Raw documentation data\n```\n\n## \ud83d\udee0\ufe0f Advanced Features\n\n### Incremental Documentation\nOnly regenerate documentation for files that have changed:\n```bash\n# First run - documents everything\nai-doc-gen\n\n# Subsequent runs - only changed files\nai-doc-gen\n```\n\n### Custom Prompts\nCustomize the documentation style:\n```python\nconfig = Config(\n    system_prompt=\"Generate concise API documentation focusing on usage examples...\"\n)\n```\n\n### Multiple Models\nUse different models for different purposes:\n- `gpt-4o`: Best quality, detailed documentation\n- `gpt-4o-mini`: Faster and cheaper, good for most projects\n- `gpt-4-turbo-preview`: Balance of quality and cost\n\n## \ud83e\uddea Development\n\n```bash\n# Clone the repository\ngit clone https://github.com/haseebrj17/ai-doc-generator.git\ncd ai-doc-generator\n\n# Install development dependencies\npip install -e \".[dev]\"\n\n# Run tests\npytest\n\n# Run linting\nblack .\nflake8 .\nmypy .\n\n# Run tests with coverage\npytest --cov=ai_doc_generator\n```\n\n## \ud83d\udcda Documentation\n\nThe project documentation is available at: https://haseebrj17.github.io/ai-doc-generator/\n\n### Setting up GitHub Pages\n\n1. Go to Settings \u2192 Pages in your GitHub repository\n2. Under \"Build and deployment\", select \"Deploy from a branch\"\n3. Choose `gh-pages` branch and `/ (root)` folder\n4. Click Save\n\n## \ud83d\ude80 Publishing to PyPI\n\nThis project has automated publishing workflows:\n\n### Automatic Publishing\nWhen you push changes to main with an updated version in `pyproject.toml`, the package will automatically be published to PyPI if all tests pass.\n\n### Manual Publishing\n1. Create a new tag: `git tag v1.0.1 && git push origin v1.0.1`\n2. The workflow will automatically publish to PyPI\n\n### Setting up PyPI Tokens\n1. Create an account on [PyPI](https://pypi.org)\n2. Generate an API token from your account settings\n3. Add the token as `PYPI_API_TOKEN` in your repository secrets (Settings \u2192 Secrets \u2192 Actions)\n4. Optionally, add `TEST_PYPI_API_TOKEN` for test releases\n\n## \ud83e\udd1d Contributing\n\nContributions 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.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## \ud83d\ude4f Acknowledgments\n\n- OpenAI for providing the GPT models\n- The Python AST module for code analysis\n- All contributors and users of this project\n\n## \ud83d\udcde Support\n\n- \ud83d\udce7 Email: muhamadhaseeb2001@gmail.com\n- \ud83d\udc1b Issues: [GitHub Issues](https://github.com/haseebrj17/ai-doc-generator/issues)\n- \ud83d\udcac Discussions: [GitHub Discussions](https://github.com/haseebrj17/ai-doc-generator/discussions)\n\n---\n\n**Made with \u2764\ufe0f by [Muhammad Haseeb](https://github.com/haseebrj17)**\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "AI-powered documentation generator for Python projects using OpenAI",
    "version": "1.0.1",
    "project_urls": {
        "Documentation": "https://github.com/haseebrj17/ai-doc-generator/wiki",
        "Homepage": "https://github.com/haseebrj17/ai-doc-generator",
        "Issues": "https://github.com/haseebrj17/ai-doc-generator/issues",
        "Repository": "https://github.com/haseebrj17/ai-doc-generator"
    },
    "split_keywords": [
        "documentation",
        " ai",
        " openai",
        " gpt",
        " automation",
        " python"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d6cbb88caecaba3e4b701c790b75b5cd281913586f14846d7e17a0e0faf3f414",
                "md5": "6fb2e7204503be5849fd4ed4b864081b",
                "sha256": "50f9b113c613869b723fe2f07d255d84f7ede3a6a943907a52a1ece2645e6a81"
            },
            "downloads": -1,
            "filename": "ai_doc_generator-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6fb2e7204503be5849fd4ed4b864081b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 24694,
            "upload_time": "2025-07-20T11:41:19",
            "upload_time_iso_8601": "2025-07-20T11:41:19.785113Z",
            "url": "https://files.pythonhosted.org/packages/d6/cb/b88caecaba3e4b701c790b75b5cd281913586f14846d7e17a0e0faf3f414/ai_doc_generator-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "44eeedb1804d1bfa5ad664bff544e055e3912f8f226320b50f483b699d64dd51",
                "md5": "4e4f84e8390953d972210ad2b882ee40",
                "sha256": "58531f36798c6a1793768332b52a6f41c328dc96bcec3f2e42fce064a0140654"
            },
            "downloads": -1,
            "filename": "ai_doc_generator-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "4e4f84e8390953d972210ad2b882ee40",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 42580,
            "upload_time": "2025-07-20T11:41:21",
            "upload_time_iso_8601": "2025-07-20T11:41:21.217688Z",
            "url": "https://files.pythonhosted.org/packages/44/ee/edb1804d1bfa5ad664bff544e055e3912f8f226320b50f483b699d64dd51/ai_doc_generator-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-20 11:41:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "haseebrj17",
    "github_project": "ai-doc-generator",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "pytest",
            "specs": [
                [
                    ">=",
                    "7.0.0"
                ]
            ]
        },
        {
            "name": "pytest-cov",
            "specs": [
                [
                    ">=",
                    "4.0.0"
                ]
            ]
        },
        {
            "name": "pytest-mock",
            "specs": [
                [
                    ">=",
                    "3.10.0"
                ]
            ]
        },
        {
            "name": "pytest-asyncio",
            "specs": [
                [
                    ">=",
                    "0.20.0"
                ]
            ]
        },
        {
            "name": "coverage",
            "specs": [
                [
                    ">=",
                    "7.0.0"
                ]
            ]
        },
        {
            "name": "responses",
            "specs": [
                [
                    ">=",
                    "0.22.0"
                ]
            ]
        },
        {
            "name": "faker",
            "specs": [
                [
                    ">=",
                    "15.0.0"
                ]
            ]
        },
        {
            "name": "factory-boy",
            "specs": [
                [
                    ">=",
                    "3.2.0"
                ]
            ]
        },
        {
            "name": "mypy",
            "specs": [
                [
                    ">=",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "types-requests",
            "specs": []
        },
        {
            "name": "flake8",
            "specs": [
                [
                    ">=",
                    "6.0.0"
                ]
            ]
        },
        {
            "name": "black",
            "specs": [
                [
                    ">=",
                    "22.0.0"
                ]
            ]
        },
        {
            "name": "isort",
            "specs": [
                [
                    ">=",
                    "5.0.0"
                ]
            ]
        },
        {
            "name": "setuptools",
            "specs": [
                [
                    ">=",
                    "80.9.0"
                ]
            ]
        },
        {
            "name": "openai",
            "specs": [
                [
                    ">=",
                    "1.0.0"
                ]
            ]
        },
        {
            "name": "tqdm",
            "specs": [
                [
                    ">=",
                    "4.65.0"
                ]
            ]
        },
        {
            "name": "pathlib",
            "specs": [
                [
                    ">=",
                    "1.0.1"
                ]
            ]
        }
    ],
    "lcname": "ai-doc-generator"
}
        
Elapsed time: 2.38598s