unref
Find unreferenced Python code.
unref reports the unused functions, classes, methods, variables and attributes of a Python project:
those that nothing references.
Documentation: unref.readthedocs.io
Quick start
Run it with uvx:
$ uvx unref
src/project/models.py:12:7: unused-class 'Account'
src/project/utils.py:40:5: unused-function 'parse_date'
Or as a pre-commit or prek hook, alongside Ruff:
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.17.4
hooks:
- id: ruff-check
- id: ruff-format
- repo: https://github.com/Apakottur/unref
rev: "" # The latest release.
hooks:
- id: unref
Benchmark
Checking the whole CPython codebase (v3.14.0, about 2,100 files):
| Tool | Time |
|---|---|
| unref | 3.96s |
| unref (one process) | 9.32s |
| vulture | 14.87s |
Measured with scripts/benchmark.py.
Why
Unused code piles up in every codebase, and faster than ever now that AI tools write much of it and tend to leave unused code behind.
Finding and removing dead code reduces bloat, speeds up AI code scanning and simplifies development.
Ruff does not support this yet, see
astral-sh/ruff#872. unref exists to fill the gap until
Ruff supports it natively.
unref follows Vulture, the tool that has long filled this
role, as a fast and modern package that follows the conventions of Ruff.
Contributing
See CONTRIBUTING.md.
Metadata
Release files for unref 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| unref-0.1.0.tar.gz | 168.6 kB | Without provenance | Details for unref-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| unref-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for unref-0.1.0-py3-none-any.whl |
Total release size: 210.5 kB
Release files / unref-0.1.0.tar.gz
| Download URL | unref-0.1.0.tar.gz |
|---|---|
| Size | 168.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
132ecf13c971a2099d3dec0f6321d5e42b2b849c3331d892703d9ebd415db4bd
|
|
BLAKE2b-256 checksum How to use checksums |
7d6e38449daf812000d2fa95cb8d62733252193c69ca9f4e4c89cef1a6b3b709
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / unref-0.1.0-py3-none-any.whl
| Download URL | unref-0.1.0-py3-none-any.whl |
|---|---|
| Size | 41.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
80f210af378729468b6d76b4be770509f991ed5414df8ecba90b61f486fe0cdd
|
|
BLAKE2b-256 checksum How to use checksums |
0ddf85b3b446cba50d2e789cada76b0d8dd4298d967faf19f942d6cfefb040a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for unref 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.