I stumbled upon a new package this week called "unref". The unref package or tool is the fastest dead-code finder for Python and is written in Rust. Dead code is code that you create and then never use. Or your AI agent creates the code, uses a different solution, and leaves the cruft behind. Dead code also gets generated during refactors if you don't clean up after yourself.
The unref tool is 20x faster than vulture, one of the most popular Python dead code finders. It also has built-in rules for pytest, Django, Flask, Pydantic, SQLAlchemy and more, so you don’t have to spend a lot of time setting it up for many of your apps.
You can run unref using the uv package manager:
You can use unref with pre-commit or prek. Here is what you would need to add to your configuration:
Alternatively, you can use unref in your GitHub Actions with a YAML file like this:
You can configure unref in your pyproject.toml file. Full details are in the documentation.
Give unref a try and let me know what you think!





The bigger difference from vulture is how it decides: unref walks reachability from entry points, so a function only called by other dead code is flagged too, while vulture only flags names nothing references. For a library, list the public API in __all__ or used-names first, or the whole API shows up as dead.