Skip to main content

Estimate the downstream impact ('blast radius') of a PyPI package version from deps.dev dependent counts and download volume.

Project description

pypi-blast-radius

Estimate the downstream impact of a specific PyPI package version — how many other projects would be affected if it had a vulnerability. It combines deps.dev direct/indirect dependent counts with an optional monthly-download figure into a single, conservative impact proxy you can use to rank findings.

The proxy is ranking evidence, not a precise affected-install count. PyPI does not expose reliable reverse-dependent download totals, so any such number is an estimate.

Install

pip install pypi-blast-radius

Library usage

from pypi_blast_radius import estimate_blast_radius

result = estimate_blast_radius("requests", "2.31.0", direct_downloads=1_000_000)
print(result["direct_dependent_count"])         # from deps.dev
print(result["indirect_dependent_count"])       # from deps.dev
print(result["estimated_transitive_downloads"]) # bounded proxy
print(result["total_impact_score"])             # downloads + proxy

If deps.dev has no data for the version, or inputs are missing, an empty dict is returned (never an exception).

CLI

pypi-blast-radius requests 2.31.0 --downloads 1000000
pypi-blast-radius requests 2.31.0 --json

How the proxy works

  • direct_dependent_count and indirect_dependent_count come straight from deps.dev.
  • estimated_transitive_downloads = direct_downloads * min(10, log1p(direct + 0.2*indirect) * 0.9) — indirect dependents are weighted lower, and the multiplier is capped at 10x so a huge dependent graph can't produce an absurd number.
  • Results are cached in-process; call clear_cache() to reset.

License

MIT

Project details


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.

pypi_blast_radius-0.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file pypi_blast_radius-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pypi_blast_radius-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 375df3a9bee88e211f2a3676b8715e8564d2c0eec8f66b14fa84267654e65eff
MD5 6f8efe038ab119e8f0bcb77b1212b197
BLAKE2b-256 be2f000a662cf3a257ca25942aaaff23434c16f8fbc09c1907d88b4a5f3fb6d2

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