Skip to content

Xynash/Automated-Python-Docstring-Generator-T-B

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

57 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“„ Docgen : Automated Universal Documentation tool

Version Python FastAPI Groq AI

Docgen is a professional-grade, service-oriented platform designed to automate the lifecycle of code documentation and quality auditing across multiple programming languages. By orchestrating Abstract Syntax Trees (AST) with the Llama 3.3 70B model via Groq’s high-speed LPU architecture, the platform performs deep semantic analysis to produce production-ready code intelligence for Python, Java, JavaScript, and C++.

πŸ“Œ Project Overview

The Docgen Platform allows users to:

  • Generate Docstrings: Automatically insert professional documentation into Python code using AST logic.
  • Polyglot Support: Document and analyze logic for Java, JavaScript, and C++ via intelligent AI routing.
  • Logic-Aware Code Review: Perform structured audits to detect bugs, security risks, and optimization needs.
  • README Generation: Synthesize entire codebases into a professional GitHub-style README.md.
  • Interactive Code Chat: Query specific code blocks and logic via a real-time conversational assistant.
  • Multi-Style Formatting: Toggle between Google, NumPy, and Sphinx documentation standards.
  • Batch Processing: Upload multiple files or a Project ZIP for bulk documentation.

This project is suitable for:

  • Engineering teams maintaining large codebases.
  • Open-source contributors requiring standardized documentation.
  • Automated CI/CD documentation pipelines.

πŸ› οΈ Tech Stack

Category Technology
Frontend Streamlit
Backend FastAPI
AI Engine Groq LPU + Llama 3.3 70B Model
Static Analysis Python AST (Abstract Syntax Tree)
Telemetry PSUtil (RAM & Latency Tracking)
Data Validation Pydantic Models
Environment Python Virtual Environment (.venv)

πŸ“‚ Project Architecture

The platform follows a Decoupled Service-Oriented Architecture (SOA) to ensure modularity and scalability.

AUTOMATED-PYTHON-DOCSTRING-GENERATOR-T-B/
β”œβ”€β”€ .streamlit/                 # UI Configuration & Dashboard Theming
β”‚   └── config.toml
β”œβ”€β”€ app/                        # Main Application Logic
β”‚   β”œβ”€β”€ api/                    # RESTful Service Layer (FastAPI)
β”‚   β”‚   β”œβ”€β”€ main.py             # Unified Gateway & Task Routing logic
β”‚   β”‚   └── __init__.py
β”‚   β”œβ”€β”€ core/                   # The Intelligence Engine (Brain)
β”‚   β”‚   β”œβ”€β”€ ai_docstring_engine.py # Core LLM Orchestration (Groq/Llama)
β”‚   β”‚   β”œβ”€β”€ ai_engine.py        # Feature extraction & context analysis
β”‚   β”‚   β”œβ”€β”€ chat_engine.py      # Conversational code assistant logic
β”‚   β”‚   β”œβ”€β”€ code_reviewer.py    # Structured bug & security auditing
β”‚   β”‚   β”œβ”€β”€ docstring_gen.py    # Heuristic fallback system
β”‚   β”‚   β”œβ”€β”€ file_handler.py     # File I/O orchestration
β”‚   β”‚   β”œβ”€β”€ inserter.py         # Surgical AST code re-insertion
β”‚   β”‚   β”œβ”€β”€ parser.py           # AST node mapping & metadata extraction
β”‚   β”‚   β”œβ”€β”€ prompt_builder.py   # High-context prompt engineering
β”‚   β”‚   └── readme_generator.py # Automatic project documentation logic
β”‚   β”œβ”€β”€ utils/                  # Shared Helpers
β”‚   β”‚   β”œβ”€β”€ validators.py       # Syntax and file-integrity checks
β”‚   β”‚   └── __init__.py
β”‚   β”œβ”€β”€ streamlit_app.py        # Enterprise Dashboard UI
β”‚   └── __init__.py
β”œβ”€β”€ docgen-extension/           # VS Code Extension source code
β”œβ”€β”€ docgen.py                   # Main CLI Entry point
β”œβ”€β”€ docstring.py                # Standalone documentation utility
β”œβ”€β”€ requirements.txt            # Production-grade dependencies
β”œβ”€β”€ .env                        # Environment Secrets (Local only)
β”œβ”€β”€ .gitignore                  # Professional Git exclusion rules
β”œβ”€β”€ LICENSE                     # MIT License
└── README.md                   # Platform Documentation

βœ… Prerequisites

Ensure the following are installed on your system:

  • Python 3.9 or higher
  • pip (Python package manager)
  • Git
  • Groq API Key (Available at console.groq.com)

Check your versions:

python --version
pip --version
git --version

βš™οΈ Step-by-Step Setup Guide

1. Create and Activate Virtual Environment

python -m venv .venv

Activate:

Windows:

.venv\Scripts\activate

macOS / Linux:

source .venv/bin/activate

2. Install Required Dependencies

Create / verify requirements.txt:

streamlit
fastapi
groq
uvicorn
dotenv

Install all dependencies:

pip install -r requirements.txt

3. Configure API Keys

Create a file named .env in the root directory and add your key: code Text

GROQ_API_KEY=gsk_your_key_here

▢️ Running the Application

Option 1: Web Dashboard (Streamlit)

python -m streamlit run app/streamlit_app.py

Accessible at:

 http://localhost:8501

Option 2: Backend API (FastAPI)

python -m uvicorn app.api.main:app --reload

Interactive Documentation: http://127.0.0.1:8000/docs

πŸ§ͺ Supported Capabilities

πŸ“„ Source Inputs

  • βœ… Python (.py) - Full AST Support

  • βœ… Java (.java) - Routed AI Logic

  • βœ… JavaScript (.js) - Routed AI Logic

  • βœ… C/C++ (.c, .cpp) - Routed AI Logic

  • βœ… Project ZIP - Automated Batch Extraction

πŸ”Š Intelligence Tasks

  • βœ… Documentation: Generates Google, NumPy, or Sphinx docstrings.

  • βœ… Code Review: Structured JSON analysis of bugs and security risks.

  • βœ… README Gen: Comprehensive Markdown project overviews.

  • βœ… Telemetry: Real-time RAM (MB) and Latency monitoring per request.


πŸ” Git Workflow (Important)

Add and Commit Changes

git add .
git commit -m "Feature: Added Multi-Language Routing"

Push ONLY to Your Branch

git push origin Member-x

🚫 Never push directly to main without a Pull Request review.

🚨 Common Errors & Fixes

Error Solution

  • JSON Decode Error (422) Ensure input code is wrapped in a {"code": "..."} JSON object.
  • Attribute "app" not found Ensure app = FastAPI() is defined in app/api/main.py.
  • ModuleNotFoundError Ensure you have activated the .venv and run pip install.
  • Memory Error Ensure psutil is installed for telemetry features.

πŸ‘₯ Team B

  • Ansh Sharma

  • Sreya Merin Sam

  • Kasa Navya Sri Durga

  • Vattikoti Pooja

⭐ Acknowledgements

  • Streamlit Team
  • Open-source Python Community
  • Mentor Guidance

✨ This project follows professional Git and Python development practices for AI-driven code intelligence.

About

AI-powered Python docstring generator that automatically analyzes code and generates professional, standardized documentation in seconds. Supports Google, NumPy, and reStructuredText styles. Saves time, ensures 100% coverage, improves readability, and integrates easily with editors or APIs for seamless workflow.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors