PyBlastRadius
Operational Blast Radius Intelligence Platform โ Predict cascading failures and quantify business impact across infrastructure, data pipelines, and AI systems.
โจ What's New in v0.2
- ๐ณ Interactive Tree Visualization โ Explore dependencies as navigable trees (JSON, Rich terminal, HTML/D3)
- ๐ 6 Tree Types โ Call graphs, reverse dependencies, imports, blast radius, databases, test coverage
- ๐จ Multiple Renderers โ Colorized terminal, pan/zoom interactive HTML with D3.js
- โ 14 Unit Tests โ Full test coverage for trees and analysis modules
- ๐ง Real Discoverers โ AST-based Python import walking + LocalDiscoverer
Features
Core Capabilities
- Unified Dependency Discovery โ Kubernetes, Terraform, Airflow, Python imports, OpenTelemetry
- Interactive Tree Visualization โ Navigate dependencies across 6 relationship types
- Cascade Prediction โ Understand which systems fail when one service goes down
- Blast Radius Analysis โ BFS-based impact categorization (direct, indirect, tertiary)
- Criticality Scoring โ Risk-weighted ranking using downstream dependencies
- Test Coverage Mapping โ Which tests cover which modules
Discovery Sources
- โ Local Python โ AST-based import graph walking
- โ Kubernetes โ Services, deployments, network policies
- โ Terraform โ AWS, Azure, GCP resources
- โ Airflow โ DAG lineage, task dependencies
- โ OpenTelemetry โ Runtime traces, service calls
Quick Start
Installation
# Basic installation (Rust wheels only)
pip install pyblastradius
# With CLI features (includes click, rich)
pip install pyblastradius[cli]
CLI: Discover & Analyze
# Auto-discover Python imports in current directory
pyblastradius scan --output graph.json
# Analyze blast radius
pyblastradius analyze graph.json --service api-server --format table
# Rank by criticality
pyblastradius criticality graph.json --limit 10
CLI: Tree Visualization (NEW!)
# View call tree in terminal (colorized)
pyblastradius tree graph.json --type call --root api-server --format rich
# Generate interactive HTML visualization
pyblastradius tree graph.json --type call --root api-server --format html --output tree.html
# Blast radius impact cascade
pyblastradius tree graph.json --type blast_radius --root api-server --format rich
# Database dependency tree
pyblastradius tree graph.json --type database --root postgres --format json
# Test coverage mapping
pyblastradius tree graph.json --type test_coverage --root mymodule --format html
# All formats: json, rich (terminal), html (interactive D3)
Python API: Trees
from pyblastradius._core import PyGraph
from pyblastradius.trees import build_tree, TreeType, render_json
# Create graph
g = PyGraph()
g.add_node('api', 'Service')
g.add_node('auth', 'Service')
g.add_node('db', 'Database')
g.add_edge('api', 'auth', 'Calls')
g.add_edge('api', 'db', 'Queries')
# Build tree
tree = build_tree(g, TreeType.CALL, 'api', max_depth=5)
# Render
json_output = render_json(tree) # JSON
print(tree) # Rich terminal output
# Or HTML
from pyblastradius.render.html_renderer import render_html
html = render_html(tree, title="Call Tree")
with open('tree.html', 'w') as f:
f.write(html)
Python API: Analysis
from pyblastradius._core import PyGraph
from pyblastradius.analysis import BlastRadiusAnalyzer, CriticalityScorer
# Create graph
g = PyGraph()
g.add_node('api', 'Service')
g.add_node('db', 'Database')
g.add_edge('api', 'db', 'Queries')
# Analyze
analyzer = BlastRadiusAnalyzer(g)
result = analyzer.analyze('api', max_depth=3)
print(f"Score: {result.score:.2f}")
print(f"Impacted: {result.directly_impacted}")
# Criticality
scorer = CriticalityScorer(g)
scores = scorer.score_all()
for node, score in scores.items():
print(f"{node}: {score:.2f}")
Python API: Discovery
from pyblastradius.discovery import LocalDiscoverer
# Discover Python imports
discoverer = LocalDiscoverer('./myproject', namespace_prefix='myproject')
graph = discoverer.discover()
print(f"Found {graph.node_count()} modules")
Tree Types (6 Relationship Models)
| Tree Type | Direction | Use Case | Edge Filter |
|---|---|---|---|
| Call | Forward | "What does this service call?" | Calls |
| Reverse Call | Backward | "What services call this?" | Calls |
| Import | Forward | "What modules does this import?" | Imports |
| Database | Forward | "What databases does this query?" | Queries |
| Blast Radius | Backward | "What fails if this goes down?" | All types |
| Test Coverage | Backward | "Which tests cover this?" | Tests |
Output Formats (3 Renderers)
JSON Tree
{
"id": "api",
"label": "api-server",
"node_type": "Service",
"depth": 0,
"children": [
{
"id": "auth",
"label": "auth-service",
"node_type": "Service",
"depth": 1,
"is_cycle": false
}
]
}
Rich Terminal
api-server (Service)
โโโ auth-service (Service)
โ โโโ postgres (Database)
โโโ cache (Cache)
Interactive HTML/D3
- Pan and zoom
- Hover tooltips showing node type, depth, metadata
- Cycle detection visualization (dashed edges)
- Color-coded by node type
- Self-contained, no external dependencies
Architecture
PyBlastRadius = Rust Core + Python Layer
โ
โโโ Rust (src/)
โ โโโ Graph Model (petgraph + HashMap)
โ โโโ Analysis (Blast Radius, Criticality, Simulator)
โ โโโ PyO3 Bindings (PyGraph wrapper)
โ
โโโ Python (python/pyblastradius/)
โโโ Discovery (LocalDiscoverer, Kubernetes, Terraform, etc.)
โโโ Trees (TreeNode, build_tree, cycle detection)
โโโ Renderers (JSON, Rich, HTML/D3)
โโโ Analysis (BlastRadiusAnalyzer, CriticalityScorer, Simulator)
โโโ CLI (scan, analyze, tree, criticality, simulate)
Performance
- Graph Build: <100ms for 1000-node graphs
- Blast Radius Analysis: <50ms per service
- Tree Building: <10ms for 5-level trees
- HTML Rendering: <1s self-contained document generation
Testing
pytest python/pyblastradius/tests/ -v
# โ
14/14 tests passing
# โข 9 tests for tree module
# โข 5 tests for analysis module
Coverage:
- TreeNode creation, serialization, to_dict()
- All 6 tree types with cycle detection
- Blast radius, criticality, simulator
- Max depth enforcement, nonexistent nodes
Distribution
PyPI v0.2 โ Wheels Only
Pure binary wheels (no compilation required):
pyblastradius-0.2.0-cp310-cp310-linux_x86_64.whlpyblastradius-0.2.0-cp311-cp311-macosx_arm64.whlpyblastradius-0.2.0-cp312-cp312-win_amd64.whlpyblastradius-0.2.0-cp313-cp313-manylinux_2_17_x86_64.whl
Install:
pip install pyblastradius
Next Steps (Backlog)
- Edge-type filtering in tree walker (currently returns all neighbors)
- Incremental graph loading for 100k+ node repos
- REST API server (FastAPI)
- IDE integrations (VS Code, JetBrains)
- Advanced cycle analysis
- Custom visualization templates
- dbt integration (column-level lineage)
- StatGuardian integration (data quality cascade)
License
Proprietary License โ Free to use with explicit attribution
Contributing
Contributions welcome! See CONTRIBUTING.md for guidelines.
Support
- Issues: GitHub Issues
- Documentation: docs/
- Examples: examples/
Built with โค๏ธ by Georgi Mammen Mullassery
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
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 pyblastradius-0.2.0-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyblastradius-0.2.0-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 276.7 kB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ab3375cacd03f67cc57d8eeb7f6f2fdd68e4604067a270cff0982dc86f3eee9
|
|
| MD5 |
0af8b1b046d119ab1c01347b05664f72
|
|
| BLAKE2b-256 |
f11589051b404a52383084cfbd287d949b9c91251c4ce38d21be297b66f9b89e
|