Complexity Fitness Analyzer for Codebases - Measures whether your codebase is more complex than it needs to be
Project description
๐ฅ Prometheus
Complexity Fitness Analyzer for Codebases
Named after the Titan who gave fire to humanity
Copyright ยฉ 2025 Andrew H. Bond andrew.bond@sjsu.edu
The Thesis
Simpler systems are more reliable. This isn't opinionโit's physics:
- Shannon's Information Theory: More bits = more error probability
- Thermodynamics (Landauer): Complex systems require more energy to maintain
- Reliability Engineering: R = rโ ร rโ ร ... ร rโ (more components = exponentially lower reliability)
Prometheus measures whether your codebase is more complex than it needs to be.
Quick Start
pip install radon lizard
# Analyze a GitHub repo
python prometheus.py pallets/flask
# Compare multiple repos with one command
python olympus.py -f repos.txt -o comparison.html
repos.txt:
pallets/flask
psf/requests
django/django
That's it. Olympus clones, analyzes, and generates an interactive comparison dashboard.
The Tools
| Tool | Named After | Purpose |
|---|---|---|
| olympus.py | Home of the gods | ๐ Orchestrator โ one command to analyze everything |
| prometheus.py | Titan of forethought | Core analyzer โ 2D fitness quadrant |
| hubris.py | Greek concept of fatal pride | Resilience theater detector |
| prometheus_ui.py | โ | Shared UI components & bivariate color palette |
| shield_analyzer.py | Aegis (Shield of Zeus) | Resilience pattern detector |
| entropy_analyzer.py | Shannon | Complexity metrics |
| scent_analyzer.py | Code smells | NIH patterns, staleness, freshness |
| sentinel.py | Security guard | Security vulnerability scanner |
| oracle.py | Delphi | LLM-assisted analysis |
๐ Olympus: One Command to Rule Them All
New in v2.0: Olympus is now the orchestrator. One command analyzes multiple repos:
python olympus.py -f repos.txt -o comparison.html
What it does:
- Reads
repos.txt(oneowner/repoper line) - Clones each repo (shallow, cached in
.olympus_cache/) - Runs prometheus.py (complexity + resilience)
- Runs hubris.py (theater detection)
- Generates interactive HTML comparison dashboard
Output:
======================================================================
OLYMPUS - Multi-Repository Comparison
======================================================================
[clone] pallets/flask... OK
[prometheus] pallets/flask... OK
[hubris] pallets/flask... OK
[clone] psf/requests... OK
[prometheus] psf/requests... OK
[hubris] psf/requests... OK
HTML: comparison.html
Features
- Bivariate color gradient: 16ร16 dithered quadrant chart with distinct colors per quadrant
- GitHub avatars: Visual identification of each repo
- Interactive tooltips: Hover for details
- Glossary: Built-in definitions for all terms (FORTRESS, GLASS HOUSE, Theater Ratio, etc.)
- Ranked table: Sortable by health score, complexity, resilience, theater ratio
- Caching: Re-runs skip already-analyzed repos
Flexible Input
# From file
python olympus.py -f repos.txt -o comparison.html
# Direct arguments
python olympus.py pallets/flask psf/requests -o comparison.html
# Mix remote and local
python olympus.py pallets/flask ./my-local-project -o comparison.html
# Existing JSON reports
python olympus.py prometheus_flask.json prometheus_django.json -o comparison.html
The Prometheus Quadrant
HIGH RESILIENCE
โ
๐ DEATHTRAP โ ๐ฐ FORTRESS
(Complex AND โ (Over-engineered
undefended) โ but defended)
โ
โโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโ
โ
๐ GLASS HOUSE โ ๐๏ธ BUNKER
(Simple but โ (Ideal: Simple
fragile) โ and defended)
โ
LOW RESILIENCE
โ HIGH COMPLEXITY LOW COMPLEXITY โ
Goal: Move toward the BUNKER quadrant (bottom-right).
Quadrant Definitions
| Quadrant | Description | Action |
|---|---|---|
| ๐๏ธ BUNKER | Low complexity, high resilience. The ideal. | Maintain |
| ๐ฐ FORTRESS | Low complexity, low resilience. Hidden technical debt. | Add error handling |
| ๐ GLASS HOUSE | High complexity, low resilience. Visibly fragile. | Simplify OR add resilience |
| ๐ DEATHTRAP | High complexity, high resilience. Over-engineered. | Simplify |
Hubris: Resilience Theater Detector
Core thesis: "The complexity added by reliability patterns can introduce more failure modes than it prevents."
Hubris detects cargo cult resilienceโpatterns that look defensive but are implemented incorrectly:
| Anti-Pattern | Problem |
|---|---|
| Retry without backoff | Thundering herd |
| Retry without max attempts | Infinite loops |
| Uncoordinated timeouts | Cascading failures |
| Invisible circuit breakers | Silent failures |
except Exception: pass |
Swallowed errors |
| Untested fallbacks | False confidence |
| Multiple resilience libraries | Complexity explosion |
Theater Ratio
Theater Ratio = patterns_detected / patterns_correct
| Ratio | Meaning |
|---|---|
| 1.0 | Perfect โ all patterns correctly implemented |
| 1.5 | 50% cargo cult |
| โ | All theater, no substance |
Usage
# Standalone
python hubris.py pallets/flask --html hubris_report.html
# Integrated (via Olympus)
python olympus.py -f repos.txt # Hubris runs automatically
Installation
From PyPI (Recommended)
# Basic installation
pip install prometheus-analyzer
# With security scanning (bandit)
pip install prometheus-analyzer[security]
# Full suite with all optional dependencies
pip install prometheus-analyzer[full]
After installation, use the commands:
prometheus pallets/flask
olympus -f repos.txt -o comparison.html
hubris pallets/flask --html hubris_report.html
From Source
git clone https://github.com/yourusername/prometheus.git
cd prometheus
pip install -e .
Manual Installation (Legacy)
If installing manually without the package:
# Minimal (Prometheus only)
pip install radon lizard
# Full Suite
pip install radon lizard bandit
Optional (Go analysis)
go install github.com/securego/gosec/v2/cmd/gosec@latest
Metrics
Complexity (Entropy Analyzer)
| Metric | Good | Bad |
|---|---|---|
| Cyclomatic Complexity | < 5 | > 10 |
| Cognitive Complexity | < 10 | > 20 |
| Maintainability Index | > 65 | < 40 |
| Token Entropy | 4-6 | > 8 |
Resilience (Shield Analyzer)
| Pattern | Quality Checks |
|---|---|
| Retry | Backoff? Jitter? Max attempts? |
| Timeout | Coordinated? Reasonable values? |
| Circuit Breaker | Metrics? Fallback? Thresholds? |
| Rate Limiting | Per-client? Graceful degradation? |
Freshness (Scent Analyzer)
| Rating | Criteria |
|---|---|
| ๐ข FRESH | Active development, modern patterns |
| ๐ก STALE | < 6 months since last commit |
| ๐ MOLDY | 6-12 months, outdated deps |
| ๐ด ROTTEN | > 1 year, deprecated patterns |
Output Files
| File | Contents |
|---|---|
comparison.html |
Olympus multi-repo dashboard |
prometheus_<repo>.html |
Single-repo quadrant report |
prometheus_<repo>.json |
Machine-readable metrics |
hubris_<repo>.html |
Resilience theater report |
Example: Compare Famous Repos
repos.txt:
# Well-maintained
pallets/flask
psf/requests
encode/httpx
# Satirical (for fun)
kelseyhightower/nocode
EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
auchenberg/volkswagen
python olympus.py -f repos.txt -o hall_of_fame.html
See where FizzBuzzEnterpriseEdition (the world's most over-engineered FizzBuzz) lands on the quadrant! ๐
Philosophy
"Complexity is the enemy of reliability."
This tool exists because:
- Simpler systems have fewer failure modes (physics)
- Simpler systems are easier to understand (cognition)
- Simpler systems are cheaper to maintain (economics)
- We can measure simplicity (information theory)
Therefore: we can measure expected reliability.
The Hubris Insight
Most "reliability engineering" is theater. Teams add:
- Retries (without backoff โ thundering herd)
- Circuit breakers (without metrics โ invisible failures)
- Timeouts (uncoordinated โ cascading failures)
- Multiple resilience libraries (โ complexity explosion)
The patterns look defensive. The implementation adds failure modes.
Hubris detects this. A high theater ratio means your resilience is performance, not protection.
Contributing
Contributions welcome. The thesis:
It doesn't work until you test it. Ground state or it doesn't exist.
License
MIT
Related Work
- radon โ Python complexity metrics
- lizard โ Multi-language cyclomatic complexity
- SonarQube โ Enterprise code quality
Built to answer: "Is this codebase more complex than it needs to be?"
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prometheus_analyzer-0.1.0.tar.gz.
File metadata
- Download URL: prometheus_analyzer-0.1.0.tar.gz
- Upload date:
- Size: 109.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd16ec2731f03fe61bfa27a7a6f7c07e713aa3f7b31a4d6128d0e5162d3447b6
|
|
| MD5 |
7a7aad3078145f76aaf43c9a68ebf0b6
|
|
| BLAKE2b-256 |
8bfb540711f99cb8c33898d004e2ce1a0e4b58e315c8a2756e942a373e907493
|
File details
Details for the file prometheus_analyzer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: prometheus_analyzer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 110.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44ed5a606d593cfcf497d141e8f6b8b192e6f1a862171f179177ac19d954491f
|
|
| MD5 |
76d5c0aaa6a07beffbc6a570a0181ca9
|
|
| BLAKE2b-256 |
29ac69a90f00002f78618aad9988f4b2865180890160bb8331a0d3b38bb6bcc1
|