Find dead code
vulture - Find dead code
vulture finds unused classes, functions and variables in your code. This helps you cleanup and find errors in your programs. If you run it on both your library and test suite you can find untested code.
Due to Python’s dynamic nature it is impossible to find all dead code for a static code analyzer like vulture, because it ignores scopes and scans only token names. Additionally some dynamic items that are not explicitly called in the code may be incorrectly reported as dead code.
- Fast: Uses static code analysis
- Lightweight: Only one module
- Tested: Comes with a test suite
- Complements pyflakes and has the same output syntax
- Supports Python 2.6, 2.7 and 3.x
(Install pip: sudo apt-get install python-pip)
$ sudo pip install -U vulture
$ vulture --help
After you have found and deleted dead code, run vulture again, because it may discover more dead code.
- vulture can be used together with pyflakes
- The coverage module can find unused code more reliably, but requires all branches of the code to actually be run.
About the name
A vulture eats dead animals. A group of feeding vultures is called a wake. Simples.
Your feedback is more than welcome. Write emails to firstname.lastname@example.org or post bugs and feature requests on bitbucket:
The source code is available on bitbucket. Fork away!
- If dead code is found, exit with 1.
- Only warn if a path given on the command line cannot be found.
- Ignore unused variables starting with an underscore.
- Show warning for syntax errors instead of aborting directly.
- Print warning if a file cannot be found.
- Add support for python3
- Report unused attributes
- Find tuple assignments in comprehensions
- Scan files given on the command line even if they don’t end with .py
- Only format nodes in verbose mode (gives 4x speedup).
- First release.
Release history Release notifications
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size vulture-0.5.tar.gz (17.3 kB)||File type Source||Python version None||Upload date||Hashes View hashes|