Skip to main content

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

Project description

๐Ÿ’€ 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.

Project details


Download files

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

Source Distribution

deadrift-0.2.0.tar.gz (21.2 kB view details)

Uploaded Source

Built Distribution

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

deadrift-0.2.0-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

Details for the file deadrift-0.2.0.tar.gz.

File metadata

  • Download URL: deadrift-0.2.0.tar.gz
  • Upload date:
  • Size: 21.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for deadrift-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3ad1637cc8a466a28d7c3367ce26a5240cbe055788117cb0f5850a55d4ee563c
MD5 dbff57ab7149d9edbb96d68315426e4c
BLAKE2b-256 1997061799c7ff0dcf847ded9f0e2a1e6dbe67ec7a63c1eae55610993f0209ee

See more details on using hashes here.

File details

Details for the file deadrift-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: deadrift-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 22.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for deadrift-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2248619e535d30679dccbbe684a37be176f816994cceb7a53b19db0935cae11a
MD5 7fca0e37f3f79a06f94f8e82f701d694
BLAKE2b-256 579832d6dc2802b94d5582e00ab1100b1f621150e1cef780097d29a176dfb66e

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