Skip to main content

💀 deadrift

Find every piece of code your team is afraid to delete — and prove it's safe.

PyPI version Python 3.11+ License: MIT Tests


Every codebase has a graveyard.

Functions built for tickets that were closed 8 months ago. Classes from a migration that completed last year. Endpoints with zero traffic since v1.2. Nobody deletes them because nobody can prove they're safe to delete.

deadrift fixes that. It combines static analysis, git history, ticket status, and production traffic into a single confidence score — and tells you exactly what's safe to remove.

deadrift scan .

  14 symbols scanned · 11 flagged

  ╭──────┬───────┬──────────────────────────┬─────────────┬──────────────────────────╮
  │ Risk │ Score │ Symbol                   │ File        │ Signals                  │
  ├──────┼───────┼──────────────────────────┼─────────────┼──────────────────────────┤
  │ HIGH │  94%  │ legacy_export_csv        │ services.py │ no callers, ticket closed│
  │ HIGH │  91%  │ LegacyBillingService     │ services.py │ no callers, untouched 8m │
  │ MED  │  73%  │ send_sms_notification    │ services.py │ no callers, no ticket    │
  ╰──────┴───────┴──────────────────────────┴─────────────┴──────────────────────────╯

What makes deadrift different

Every existing dead code tool runs static analysis only.

deadrift combines three independent signals into one confidence score:

Signal What it checks Tools today
Static call graph Does any code call this? ✅ Everyone
Git history + ticket refs Does a living ticket justify this code? ❌ Nobody
Production traffic Is this endpoint actually receiving requests? ❌ Nobody

Install

pip install deadrift
# or
pipx install deadrift

Quick start

# Scan any Python project
deadrift scan .

# Interactive dead code removal
deadrift prune . --threshold 60

# Generate HTML dashboard
deadrift scan . --html && open deadrift-report.html

# Clean AI-generated garbage comments
deadrift clean-comments .

Full command reference

deadrift scan — find dead code

deadrift scan .                          # scan with git history
deadrift scan . --no-git                 # skip git (faster)
deadrift scan . --threshold 60           # only show 60%+ confidence
deadrift scan . --html                   # generate HTML dashboard
deadrift scan . --json > results.json    # JSON output for CI

# With all signals
deadrift scan . \
  --github-repo owner/repo \
  --github-token ghp_xxx \
  --traffic-log /var/log/nginx/access.log

deadrift prune — interactively remove dead code

deadrift prune . --dry-run               # preview only
deadrift prune . --threshold 60          # interactive: d/c/k/s per symbol

For each symbol you choose:

  • d — delete permanently
  • c — comment out (reversible)
  • k — keep forever (adds # deadrift: keep)
  • s — skip for now

deadrift score — inspect one symbol

deadrift score legacy_export_csv --path .

deadrift annotate — add warning comments (non-destructive)

deadrift annotate . --threshold 60 --dry-run
deadrift annotate . --threshold 60

deadrift clean-comments — remove AI garbage comments

deadrift clean-comments . --dry-run
deadrift clean-comments .

Removes lines like:

  • # This is 100% working and fully tested! 🎉
  • # AI generated this perfectly, no changes needed!!!
  • # LGTM 👍 - AI reviewed

Suppression

Add # deadrift: keep above any def or class to suppress it forever:

# deadrift: keep
def emergency_payment_fallback(amount: float) -> bool:
    """Disaster recovery — rarely called but critical."""
    return True

GitHub Action

name: deadrift
on: [pull_request]
jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.11"
      - run: pip install deadrift
      - run: deadrift scan . --threshold 60

How scoring works

Score Label Meaning
80–100% HIGH Almost certainly safe to delete
60–79% MEDIUM Probably safe — review recommended
30–59% LOW Suspicious — check manually
0–29% SAFE Likely alive — leave it

Signals toward dead: no callers (+30), zero traffic (+20), untouched 1yr (+20), ticket closed (+20)

Signals toward alive: high traffic (-60), 3+ callers (-55), 1-2 callers (-40), ticket open (-25)


vs Vulture / Skylos

Feature deadrift Vulture Skylos
Static AST ✅ ✅ ✅
Git history mining ✅ ❌ ❌
Ticket linking ✅ ❌ ❌
Production traffic ✅ ❌ ❌
Multi-signal score ✅ ❌ ❌
Interactive prune ✅ ❌ ❌
HTML dashboard ✅ ❌ ❌
AI comment cleaner ✅ ❌ ❌
GitHub Action ✅ ❌ ✅

Contributing

git clone https://github.com/zeeshankhan/deadrift
cd deadrift
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest tests/ -v

PRs welcome. See CONTRIBUTING.md.


License

MIT © Zeeshan Khan — see LICENSE.


Built with frustration by a developer who was scared to delete code.
If deadrift helped you, ⭐ the repo.

Metadata

Release files for deadrift 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for deadrift 0.3.0
File Size Uploaded Provenance Actions
deadrift-0.3.0.tar.gz 23.3 kB Without provenance Details for deadrift-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for deadrift 0.3.0
File Interpreter ABI Platform Actions
deadrift-0.3.0-py3-none-any.whl Python 3 none any Details for deadrift-0.3.0-py3-none-any.whl

Total release size: 48.2 kB

Release files / deadrift-0.3.0.tar.gz

Download URL deadrift-0.3.0.tar.gz
Size 23.3 kB
Tags Source
SHA-256 checksum
How to use checksums
600e26422a139c3c0175cf124ecb55591deb9089597dd6ccee4c562a6ec3fca8
BLAKE2b-256 checksum
How to use checksums
56c4481e70ea024e531b52b54e348e7b57a5a7b9857e7ce0d8450f2b107ead6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release files / deadrift-0.3.0-py3-none-any.whl

Download URL deadrift-0.3.0-py3-none-any.whl
Size 24.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
197b762455255c631d29d18139de1998554af31283fcb72ed4b5f6435d3157e3
BLAKE2b-256 checksum
How to use checksums
696de3da90c0f3a8d09ab4b86df1ad7cce015cebbabbe67179b754f9c7935dcb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Security for deadrift 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page