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
llm-project-summarizer /path/to/project

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

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

Using Poetry

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

# Run with options
poetry run llm-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:

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

Command Line Options

llm-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.3.tar.gz (10.8 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.3-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llm_project_summarizer-0.0.3.tar.gz
  • Upload date:
  • Size: 10.8 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.3.tar.gz
Algorithm Hash digest
SHA256 8cffb7031c8f54eb26781c7bfafb96d980a36e75b4d8adca6120a664a07d10ad
MD5 bc3e743e60f4f99b777c382a1df3759c
BLAKE2b-256 e9733551dea029fa8cafb26441ed315d7d13c876859fb014a70423dcc586f970

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_project_summarizer-0.0.3.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.3-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_project_summarizer-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9bbbe3481dbd73bdd5e8fbc3e3643817adb7015015d7ebcbe139f7437bd09db3
MD5 d242017a3b333681db9671b90ae80a70
BLAKE2b-256 4365833f0179606e7582802f94d818bc49337f017e51854df3ff956e446a737b

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_project_summarizer-0.0.3-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