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.1.1.tar.gz (22.1 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.1.1-py3-none-any.whl (23.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for deadrift-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4061c7ffa5aab5ceddbce4e836ac58208e3618a43a407b7ae9609cf32c2fb8b2
MD5 8e8aba483f085db4ba1e0c6c526ea052
BLAKE2b-256 e5ea2a5fd812dada27597a5331401e840b121f8942de5542b0f7b03e6c2c9af3

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for deadrift-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8c992d80a4b625381024369b4a6da02387517070887aa3b5ac98f1aaa6701054
MD5 0dd0fccde168d7a530e211e0f73637d3
BLAKE2b-256 869e997fe6f1ce523d1491bc33b9b04f73d6d0c046a2bad4280200617149cf2b

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