Repolode
jendrikseipp

jendrikseipp/vulture

Static analysis tool that finds unused functions, classes, variables, imports and unreachable code in Python projects.

Stars
4,876
Forks
209
Open issues
76
Last commit
26 days ago

What is it?

Vulture scans Python files and directories to find code that is defined but never used, such as unused functions, classes, attributes, variables, imports and unreachable branches. It is based on static analysis of the abstract syntax tree, so it does not run the code. Each finding gets a confidence value from 60% to 100%, and the --min-confidence flag filters out rough guesses so only certain dead code is reported.

Because Python is dynamic, Vulture can miss dead code and may flag code that is only called implicitly. To handle false positives, it supports whitelist files that simulate usage, glob-based ignore rules for names, decorators and paths, and configuration through pyproject.toml. Results can be sorted by size to prioritize cleanup.

Vulture can be run as a CLI, invoked as a Python module, used programmatically through its API, or added to a pre-commit hook. Its output format matches pyflakes.

Key features

  • 01Detects unused functions, classes, methods, attributes, variables and imports
  • 02Finds unreachable code after return, raise, break and continue
  • 03Assigns confidence values and filters results with --min-confidence
  • 04Supports whitelist files to suppress false positives
  • 05Configurable through pyproject.toml and usable as a Python API

Use cases

  • Cleaning up a large Python codebase that has accumulated dead code
  • Finding untested code by running Vulture on both a library and its test suite
  • Running dead-code checks automatically in pre-commit or CI

Quick start

  1. 1

    Install Vulture from PyPI

    pip install vulture
  2. 2

    Run Vulture on your Python script or package directory

    vulture myscript.py mypackage/

Things to know

  • Due to Python's dynamic nature, it can miss dead code and report implicitly called code as unused.
  • Confidence values below 100% are very rough estimates.

Topics

FAQ

What is vulture?
Static analysis tool that finds unused functions, classes, variables, imports and unreachable code in Python projects. Vulture scans Python files and directories to find code that is defined but never used, such as unused functions, classes, attributes, variables, imports and unreachable branches. It is based on static analysis of the abstract syntax tree, so it does not run the code. Each finding gets a confidence value from 60% to 100%, and the --min-confidence flag filters out rough guesses so only certain dead code is reported.
Is vulture free to use? What license does it have?
vulture is open source under the MIT license. Check the license terms before using it in commercial products.
Is vulture still maintained?
Actively maintained. The last commit to vulture was on Oct 12, 2026.
What can I use vulture for?
Cleaning up a large Python codebase that has accumulated dead code Finding untested code by running Vulture on both a library and its test suite Running dead-code checks automatically in pre-commit or CI
How do I install vulture?
Install Vulture from PyPI: pip install vulture Run Vulture on your Python script or package directory: vulture myscript.py mypackage/
Where can I get vulture?
The source code and installation instructions are on GitHub: https://github.com/jendrikseipp/vulture

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects