Skip to main content

PyBlastRadius

PyPI License Python Tests Status

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.whl
  • pyblastradius-0.2.0-cp311-cp311-macosx_arm64.whl
  • pyblastradius-0.2.0-cp312-cp312-win_amd64.whl
  • pyblastradius-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


Built with โค๏ธ by Georgi Mammen Mullassery

PyBlastRadius Architecture

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyblastradius-0.2.0-cp313-cp313-macosx_11_0_arm64.whl (276.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

File details

Details for the file pyblastradius-0.2.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyblastradius-0.2.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1ab3375cacd03f67cc57d8eeb7f6f2fdd68e4604067a270cff0982dc86f3eee9
MD5 0af8b1b046d119ab1c01347b05664f72
BLAKE2b-256 f11589051b404a52383084cfbd287d949b9c91251c4ce38d21be297b66f9b89e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page