Skip to main content

Generate LLM-friendly summaries of Python and Go codebases

Project description

LLM Project Summarizer

CI/CD PyPI version Python Versions License: MIT

LLM Project Summarizer is a specialized command-line tool that transforms Python and Go codebases into concise, structured summaries optimized for Large Language Models. When working with LLMs like ChatGPT or Claude, sending entire codebases is often impractical due to context limitations. This tool solves that problem by generating intelligent summaries that capture the essential architecture, relationships, and patterns in your code while excluding implementation details.

The tool understands language-specific patterns โ€“ in Go, it recognizes packages, interfaces, and implementations; in Python, it comprehends modules, class hierarchies, and type annotations. The output is formatted in Markdown with Mermaid diagrams, making it ideal for LLM consumption and human readability.

Table of Contents

Features

โœจ Smart Code Analysis

  • Understands Python and Go code patterns
  • Extracts classes, functions, interfaces and their relationships
  • Identifies key architectural patterns

๐Ÿ“Š Rich Visualization

  • Generates Mermaid diagrams showing dependency relationships
  • Creates hierarchical package/module summaries
  • Shows inheritance and implementation relationships

๐Ÿ”ง Flexible Configuration

  • Exclude patterns and directories
  • Customize output format and detail level
  • YAML configuration support

Installation

Option 1: Install from PyPI

pip install llm-project-summarizer

Option 2: Install from GitHub

pip install git+https://github.com/MuhammadYossry/llm-project-summarizer.git

Option 3: Development Installation

# Clone the repository
git clone https://github.com/MuhammadYossry/llm-project-summarizer
cd llm-project-summarizer

# Install with poetry (recommended for development)
poetry install

# Or install with pip in editable mode
pip install -e .

Usage

Basic Usage

# Using pip installed version
project-summarizer /path/to/project

# Custom output file
project-summarizer /path/to/project -o custom_summary.md

# Exclude patterns
project-summarizer /path/to/project --exclude "vendor/*" --exclude "*.test.go"

Using Poetry

# Install and run using poetry
poetry install
poetry run project-summarizer /path/to/project

# Run with options
poetry run project-summarizer /path/to/project -o summary.md --exclude "vendor/*"

With Configuration File

Create .summarizer.yaml:

exclude:
  - "vendor/*"
  - "**/*_test.go"
  - "**/__pycache__"
output: "project_summary.md"

Use the config:

project-summarizer /path/to/project --config .summarizer.yaml

Command Line Options

project-summarizer --help

Options:
  --output, -o PATH    Output file path [default: project_summary.md]
  --exclude, -e TEXT   Exclusion patterns (can be used multiple times)
  --config, -c PATH    Path to config file
  --help              Show this message and exit

How It Works

The tool employs language-specific parsers to analyze source code. For Go, it uses pattern matching to identify packages, interfaces, and implementations. For Python, it utilizes the Abstract Syntax Tree (AST) to extract classes, functions, and their relationships. The parsed information is then organized into a hierarchical structure optimized for LLM understanding.

Examples

Input project structure:

myproject/
โ”œโ”€โ”€ cmd/
โ”‚   โ””โ”€โ”€ server/
โ”‚       โ””โ”€โ”€ main.go
โ”œโ”€โ”€ internal/
โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”‚   โ””โ”€โ”€ handlers.go
โ”‚   โ””โ”€โ”€ service/
โ”‚       โ””โ”€โ”€ users.go

Project Generated Summary

Project Architecture

This is a Go project with the following structure:

Entry Points

  • cmd/server/main.go

Package Structure

api

Key Interfaces:

  • Handler: HTTP request handler interface
  • Service: Business logic interface

Dependencies

graph TD
    api-->service
    main-->api

Here's an example analyzing a mixed Python/Go microservice:

Input project structure:

acme-service/
โ”œโ”€โ”€ api/
โ”‚   โ”œโ”€โ”€ handlers/
โ”‚   โ”‚   โ”œโ”€โ”€ user_handler.go
โ”‚   โ”‚   โ””โ”€โ”€ auth_handler.go
โ”‚   โ””โ”€โ”€ middleware/
โ”‚       โ””โ”€โ”€ jwt.go
โ”œโ”€โ”€ services/
โ”‚   โ”œโ”€โ”€ user_service.py
โ”‚   โ””โ”€โ”€ auth_service.py
โ””โ”€โ”€ models/
    โ”œโ”€โ”€ user.go
    โ””โ”€โ”€ schema.py

Project Generated Summary

Project Architecture

This is a mixed-language microservice using Go for API handlers and Python for business logic.

Package Structure

api/handlers/user_handler.go

Package: handlers

Symbols: interface: UserHandler Methods: - GetUser(id string) (*User, error) - CreateUser(user *User) error - UpdateUser(id string, user *User) error

struct: userHandler Implements: UserHandler Dependencies: UserService

services/user_service.py

Package: services

Symbols: class: UserService Methods: - async def get_user(self, id: str) -> User - async def create_user(self, user: User) -> User - async def update_user(self, id: str, user: User) -> User

Dependencies: 
  - models.User
  - database.Repository

Architecture Diagram

graph TD
    subgraph Go API Layer
        UH[UserHandler]
        AH[AuthHandler]
        JWT[JWT Middleware]
    end
    
    subgraph Python Services
        US[UserService]
        AS[AuthService]
        DB[(Database)]
    end
    
    UH --> US
    AH --> AS
    US --> DB
    AS --> DB
    JWT --> AS

Contributing

We welcome contributions. To get started:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for any new functionality
  5. Submit a pull request

Testing

Run the test suite using Poetry:

# Run all tests
poetry run pytest

# Run tests with coverage report
poetry run pytest --cov=llm_project_summarizer tests/ --cov-report=term-missing

# Run specific test files
poetry run pytest tests/test_parsers.py

License

This project is licensed under the MIT License

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

llm_project_summarizer-0.0.2.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_project_summarizer-0.0.2-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file llm_project_summarizer-0.0.2.tar.gz.

File metadata

  • Download URL: llm_project_summarizer-0.0.2.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for llm_project_summarizer-0.0.2.tar.gz
Algorithm Hash digest
SHA256 8ac208ec91e24b4686e38bd0c02f1c9a9595f8200b8215411c1509a389b6ed5d
MD5 209e16957038650b06f1a5fbabb56486
BLAKE2b-256 414a32bed4f3f6a98c2b9993df24f3596dac11594a3a0c09357d4fd431eccf54

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_project_summarizer-0.0.2.tar.gz:

Publisher: ci.yml on MuhammadYossry/llm-project-summarizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llm_project_summarizer-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_project_summarizer-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 012cd2ed9f8a0a88a25627d020c3e6f4f3b3e03ef9f9a6d3350f00f1a10707e5
MD5 2fe18cdb227f02ca76390055f89718a2
BLAKE2b-256 f0b9bf7390adf65afc885e7cd35b8a2a07ee011b119603b19567a86fe98a34f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_project_summarizer-0.0.2-py3-none-any.whl:

Publisher: ci.yml on MuhammadYossry/llm-project-summarizer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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