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 |
--stats |
off | Print import-resolution breakdown (resolved/dropped-by-reason) |
Outputs in --out:
architecture.puml— UML component diagram (the main artifact)package.puml— package/file grouping diagramarchitecture.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:
plantumlbinary (Java)docker run plantuml/plantuml.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-nodesto control diagram size.
License
MIT — see LICENSE.
Release files for repo2uml 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| repo2uml-0.2.0.tar.gz | 37.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| repo2uml-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 72.5 kB
Release files / repo2uml-0.2.0.tar.gz
| Download URL | repo2uml-0.2.0.tar.gz |
|---|---|
| Size | 37.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
83fdcff79d8331aa372e55f807fa71f4b5acdb264cbf72c61809f5557b96ea71
|
|
BLAKE2b-256 checksum How to use checksums |
fe1b9acfda42b7f2f39a9b21416059247d2fa1c59236acb0bc0f18210b7e0f22
|
| 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.2.0-py3-none-any.whl
| Download URL | repo2uml-0.2.0-py3-none-any.whl |
|---|---|
| Size | 34.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cad09907a8a5ec79396835a7b15cab0a089f7378aa8a21aef24c11accb25b0ff
|
|
BLAKE2b-256 checksum How to use checksums |
2afca3ab51a0ee251ef89888d55061c5ab21b412bd5532aa00523c4675772dac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|