CodeAtlas
Understand your codebase. Delete with confidence.
CodeAtlas is a Python static analysis tool that maps your code's real dependencies, finds dead code, and shows you exactly what breaks if you delete something.
Features
- Dead Code Detection — Finds truly unused, test-only, and uncovered code
- Impact Analysis — Shows what breaks if you delete any function or module
- Dependency Graph — Interactive D3.js visualization of your codebase
- Runtime Tracing — Captures dynamic calls (
getattr, decorators) that static analysis misses - Framework Support — Understands Django URLs, Flask blueprints, FastAPI routes
- Zero Config — Works out of the box, configurable via
pyproject.toml
Installation
pip install codeatlas
Or install from source:
git clone https://github.com/yourusername/codeatlas
cd codeatlas
pip install -e ".[dev]"
Quick Start
# Initialize config in your project
codeatlas init .
# Analyze your codebase
codeatlas analyze .
# See what breaks if you delete a function
codeatlas impact . "src/billing.py::calculate_tax"
# Trace a test run for dynamic accuracy
codeatlas trace . pytest tests/
# Launch interactive web UI
codeatlas serve . --with-trace
Commands
| Command | Description |
|---|---|
codeatlas init <path> |
Create .codeatlas.toml config |
codeatlas analyze <path> |
Build and display codebase analysis |
codeatlas impact <path> <target> |
Show deletion impact of a node |
codeatlas trace <path> <command> |
Run command with runtime tracing |
codeatlas trace-summary <path> |
Show trace database stats |
codeatlas serve <path> |
Launch interactive web UI |
Node Naming
Targets use path::object syntax:
codeatlas impact . "utils.py::helper" # function
codeatlas impact . "models.py::User" # class
codeatlas impact . "app.py" # whole module
Configuration
Add to your pyproject.toml:
[tool.codeatlas]
entry_patterns = [
"**/__main__.py",
"**/manage.py",
"**/cli.py",
]
test_patterns = [
"**/test_*.py",
"**/tests/**/*.py",
]
ignore_patterns = [
"**/venv/**",
"**/__pycache__/**",
"**/migrations/**",
]
detect_django = true
detect_flask = true
detect_fastapi = true
[tool.codeatlas.trace]
sample_rate = 1.0
max_depth = 50
db = ".codeatlas/trace.db"
Sample Output
$ codeatlas analyze .
CodeAtlas Analysis: /home/user/myproject
Nodes: 1,247 | Edges: 3,891 | Entry points: 12 | Tests: 89
Dead Code: Truly unused: 23 | Test-only: 7 | Uncovered: 156
Truly unused
├── legacy/auth.py::old_hash
├── legacy/auth.py::deprecated_login
├── api/v1/routes.py::unused_endpoint
└── ... and 20 more
Cycles found: 3
models.py → views.py → serializers.py → models.py
utils.py → helpers.py → utils.py
config.py → settings.py → config.py
Architectural bridges (high centrality):
┌─────────────────────┬────────┐
│ utils.py │ 0.1842 │
│ api/middleware.py │ 0.0921 │
│ models/base.py │ 0.0673 │
└─────────────────────┴────────┘
Web UI
$ codeatlas serve . --with-trace
CodeAtlas Web UI
Project: /home/user/myproject
Graph: 1,247 nodes, 3,891 edges
Starting server...
CodeAtlas server running at http://localhost:8765
Opens a dark-themed interactive graph:
- Drag nodes to rearrange
- Scroll to zoom
- Click any node to see deletion impact
- Search to filter
- Show Cycles to highlight circular dependencies
How It Works
- Static Analysis — Parses all
.pyfiles withast, builds a dependency graph - Framework Bridges — Scans Django/Flask/FastAPI patterns for implicit dependencies
- Runtime Tracing (optional) —
sys.settracecaptures dynamic calls - Graph Analysis — NetworkX computes reachability, cycles, centrality
- Dead Code Classification:
- Truly unused — unreachable from both tests and entry points
- Test-only — only reachable from tests
- Uncovered — reachable from production, never tested
Requirements
- Python 3.10+
- Dependencies:
networkx,click,rich
License
MIT
**[Download README.md](sandbox:///mnt/agents/output/README.md)**
Release files for pycodeatlas 0.1.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 | |
|---|---|---|---|
| pycodeatlas-0.1.0.tar.gz | 17.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pycodeatlas-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.1 kB
Release files / pycodeatlas-0.1.0.tar.gz
| Download URL | pycodeatlas-0.1.0.tar.gz |
|---|---|
| Size | 17.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8cbd3237cad554bdaceaa0d4316afbd3686c1dfb61583d37824d9bd3927a1c3d
|
|
BLAKE2b-256 checksum How to use checksums |
9baca27525ff3c912275584ba1cd85c926f7499f9cee8e486f0703974ca2eca6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / pycodeatlas-0.1.0-py3-none-any.whl
| Download URL | pycodeatlas-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bb6624aa64cb66742341d9995a507d56389ecbef4bd29315bad3b95bfea69a95
|
|
BLAKE2b-256 checksum How to use checksums |
52e2acd16441abeb844587f2e12eb3805b40cc4949cc95d6b7c230c9a562d95f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|