explaingit

jendrikseipp/vulture

4,599PythonAudience · developerComplexity · 2/5Setup · easy

TLDR

A command-line tool that scans Python codebases for dead code, unused functions, classes, variables, and imports, using static analysis with confidence scoring so you know what's safe to delete.

Mindmap

mindmap
  root((Vulture))
    What It Does
      Find dead Python code
      Static analysis
      Confidence scoring
    What It Detects
      Unused functions
      Unused classes
      Unused imports
      Unreachable blocks
    Configuration
      pyproject.toml
      Whitelist files
      Exclude paths
    Integration
      pre-commit hook
      CLI tool
    Use Cases
      Codebase cleanup
      Pre-refactor audit
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Scan a large Python project to find functions, classes, and imports that are never called anywhere.

USE CASE 2

Run Vulture as a pre-commit hook so dead code is flagged automatically before every git commit.

USE CASE 3

Generate a whitelist file for code Vulture incorrectly flags as unused so future scans stay noise-free.

USE CASE 4

Use the --min-confidence flag to focus cleanup work on only the highest-confidence unused code findings.

Tech stack

Python

Getting it running

Difficulty · easy Time to first run · 5min
No license information was provided in the explanation, check the repository directly.

In plain English

Vulture is a command-line tool for Python developers that scans a codebase and reports code that is never used: unused functions, classes, variables, imports, and unreachable blocks. In a large project that has grown over time, it is common to accumulate old code that nothing calls anymore, and Vulture is designed to surface those leftovers so they can be removed. The tool works through static analysis, meaning it reads the source files without running the program. Because Python is a dynamic language, this approach has limits: code that gets called indirectly (through reflection or dynamic dispatch) may be flagged incorrectly. To handle this, Vulture assigns a confidence percentage to each finding, from 60 percent for things like attributes and class variables up to 100 percent for function arguments and provably unreachable code. Developers can use the --min-confidence flag to focus only on the highest-confidence results. For false positives (code that Vulture flags but actually is used), the recommended approach is to create a whitelist file that lists those items. Vulture can generate this whitelist automatically with the --make-whitelist option. Files or directories can also be excluded entirely, and specific function names or decorator patterns can be ignored with additional flags. Configuration can be stored in a pyproject.toml file under the [tool.vulture] section, which avoids having to repeat flags on every run. Vulture also integrates with pre-commit, so it can run automatically before each git commit to catch dead code early. Installation is via pip. Running it is as simple as pointing Vulture at a Python file or directory. After removing flagged code, running it a second time is recommended, since removing one piece of dead code can reveal others that depended on it.

Copy-paste prompts

Prompt 1
I have a large Python Django project and want to find dead code before a refactor. How do I run Vulture on the whole project and interpret the confidence scores?
Prompt 2
Show me how to add Vulture to my pre-commit configuration so it automatically flags unused Python code before each commit.
Prompt 3
Vulture is flagging a function I know is used through dynamic dispatch. How do I add it to a whitelist so it stops showing up in results?
Prompt 4
How do I configure Vulture in pyproject.toml to always ignore my tests directory and only report findings at 80% confidence or higher?
Open on GitHub → Explain another repo

← jendrikseipp on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.