finds.dev← search

// the find

asottile/dead

★ 397 · Python · MIT · updated Jul 2026

dead simple python dead code detection

dead is a minimal Python dead code detector by Anthony Sottile that uses AST parsing to find definitions with no references. It's a single-file tool with no config beyond regexes for file/test inclusion, and it plugs into pre-commit. For small-to-medium Python codebases where you want a quick, low-ceremony check.

Single-file implementation means you can read the whole thing in 10 minutes and understand exactly what it does. Pre-commit integration works well — zero config for the common case. The `# dead: disable` escape hatch is simple and doesn't require learning a DSL. Actively maintained (last push July 2026) despite the self-deprecating README.

The false positive rate on anything using interfaces, metaclasses, or magic methods will frustrate you fast — the author admits this upfront. It's pure AST analysis with no type information, so dynamic attribute access and `getattr` patterns will produce noise. No way to suppress categories of false positives beyond line-level comments, which gets tedious on a large codebase. Vulture, the obvious alternative, has more configurability and confidence scoring — dead gives you nothing to tune.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →