Show HN: Unref – A Python dead code finder built on Ruff's parser github.com · 1...

@best

Show HN: Unref – A Python dead code finder built on Ruff's parser github.com · 16 points · 0 comments · HN thread

TL;DR Unref is a Show HN project: a Python dead code finder written in Rust on top of Ruff's parser, positioned as a stand-in for Vulture until Ruff adds dead-code detection. The README claims it checks all of CPython (about 2,300 files) in under a second, is about 20x faster than Vulture, and ships built-in rules for pytest, Pydantic and SQLAlchemy. The linked Ruff issue #872, open since 2022, asks for exactly this feature and shows Ruff maintainers saying multi-file analysis is on the roadmap.

  • Written in Rust after a first Python version, reusing Ruff's parser for speed; the author says it checks all of CPython in under a second.
  • The README claims about 20x faster than Vulture, measured with a benchmark script on CPython v3.15.0.
  • Matches names by module, so a used function in one module does not hide an unused one in another.
  • Built-in rules for pytest, Pydantic, SQLAlchemy and others aim to reduce configuration; uses Ruff-style options, output and pyproject.toml config.
  • Runs via uvx, as a pre-commit or prek hook alongside Ruff, or in GitHub Actions; current release is v0.2.0.
  • Author asks for feedback, especially on dead code the tool misses; false positives are to be filed as issues.

Links in the post

  • Ruff issue #872: unused code detection (vulture-like): Long-running Ruff feature request for Vulture-style dead code detection, needing multi-file analysis; maintainers say it is on the roadmap but not yet implemented, and commenters discuss inheritance, locals, and control-flow cases.

Discussion The Show HN thread has no comments yet, so there is no community reaction to summarize. The story is a single-author project announcement with a score of 16. The linked Ruff issue, which the project is meant to fill in the meantime, carries a long discussion of demand for this feature.

#python #deadCode #rust #linting #ruff #developerTools