Metadata-Version: 2.4
Name: pypi-blast-radius
Version: 0.1.0
Summary: Estimate the downstream impact ('blast radius') of a PyPI package version from deps.dev dependent counts and download volume.
Project-URL: Homepage, https://github.com/krc7169/pypi-blast-radius
Project-URL: Issues, https://github.com/krc7169/pypi-blast-radius/issues
Author-email: krc7169 <krc7169@gmail.com>
License: MIT License
        
        Copyright (c) 2026 krc7169
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: blast-radius,dependencies,deps.dev,impact,pypi,security,supply-chain
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Requires-Dist: requests>=2.20
Provides-Extra: dev
Requires-Dist: build; extra == 'dev'
Requires-Dist: pytest>=7; extra == 'dev'
Requires-Dist: twine; extra == 'dev'
Description-Content-Type: text/markdown

# 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](https://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

```bash
pip install pypi-blast-radius
```

## Library usage

```python
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

```bash
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
