Skip to main content

repo2uml — automatic architecture mapper

Give it an unknown GitHub repo, get back UML component diagrams (PlantUML):

              API
               │
      ┌────────┴────────┐
      ▼                 ▼
  AuthService       GameService
      │                 │
      ▼                 ▼
  UserStore        Simulation
      │                 │
      └────────┬────────┘
               ▼
            Database

Deterministic, offline, zero third-party dependencies — pure Python stdlib static analysis.

Install

Requires Python 3.9+.

pip install repo2uml

Or from source:

git clone https://github.com/petseye/repo2uml.git
cd repo2uml
pip install -e .
# or: pipx install -e .   (isolated CLI install)

Usage

repo2uml https://github.com/org/repo --out ./diagrams
repo2uml org/repo --out ./diagrams --max-nodes 10
repo2uml ./local-checkout --out ./diagrams --no-render

Options:

Flag Default Description
--out ./diagrams Output directory
--max-nodes 8 Max components in the diagram
--max-files 20000 Cap on files scanned
--format svg Render format (svg or png)
--no-render off Skip rendering, emit .puml only
--title Architecture Diagram title

Outputs in --out:

  • architecture.puml — UML component diagram (the main artifact)
  • package.puml — package/file grouping diagram
  • architecture.json — intermediate IR (components, edges, languages, frameworks)
  • architecture.svg / .png — rendered image, if a backend is available

Example output

@startuml
title Architecture
skinparam componentStyle rectangle

component [API] as API <<entryPoint>>
component [AuthService] as AuthService
component [GameService] as GameService
component [Simulation] as Simulation
component [UserStore] as UserStore
component [Database] as Database <<database>>

API --> AuthService
API --> GameService
AuthService --> UserStore
GameService --> UserStore
Simulation --> Database
UserStore --> Database
@enduml

How it works

Pipeline: ingest → inventory → parse → graph → abstract → emit

  • Ingest: shallow git clone --depth 1, tarball fallback, or local directory. Respects .gitignore-style defaults (node_modules/, vendor/, dist/, test globs excluded from components).
  • Parsers (stdlib only): Python via ast; TypeScript/JavaScript, Go, and Java via targeted regex heuristics. Framework signals (Express, Nest, FastAPI, Django, Gin, Spring) mark route files; ORM signals (SQLAlchemy, Django models, GORM, @Entity) mark persistence → Database.
  • Graph: file-level import resolution (relative imports + same-directory stem matching).
  • Abstract: files clustered by path keywords + detected roles into ≤ N components (API, *Service, *Store, Simulation, Database); edges aggregated from the file graph plus a semantic backbone (API → services, services → stores → Database) so sparse repos still read top-down.

Rendering

Render backends are tried in order:

  1. plantuml binary (Java)
  2. docker run plantuml/plantuml
  3. .puml-only + warning (diagrams still fully usable — paste into plantuml.com or any PlantUML plugin)

Tests

python -m pytest tests/ -q

Limitations

  • Static analysis only: dynamic imports, reflection-heavy DI (e.g. Spring autowiring across modules), and monorepo cross-package links may be missed or merged.
  • Regex parsers for TS/Go/Java are heuristic — Python (ast) is the most precise.
  • Large repos (>20k files) are truncated via --max-files; use --max-nodes to control diagram size.

License

MIT — see LICENSE.

Release files for repo2uml 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for repo2uml 0.1.0
File Size Uploaded
repo2uml-0.1.0.tar.gz 21.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for repo2uml 0.1.0
File Interpreter ABI Platform
repo2uml-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 43.4 kB

Release files / repo2uml-0.1.0.tar.gz

Download URL repo2uml-0.1.0.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d26ce118c5a52000c9968c5cac43139daf5416c46d55d4387e63ae0b43a2d97a
BLAKE2b-256 checksum
How to use checksums
3d1bfc7e5277bbfa98367d70525bd4b9cb59f5a46fae0f24da594b1d666ecbe1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / repo2uml-0.1.0-py3-none-any.whl

Download URL repo2uml-0.1.0-py3-none-any.whl
Size 22.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f59d660b034577a756618119501a6032247115b4179978688db3c1dbdfd181a0
BLAKE2b-256 checksum
How to use checksums
c090782eb977ca799a4512641cf40b3d3a4de7354653f05fade7e953bd8bad01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

0.2.0

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page