deadcode
Find and remove dead code.
Decision gist · record as of 2026-08-14
Yes, if you need global-scope dead code detection. The tool fills a gap that ruff and flake8 don't cover, has low install friction, active maintenance, and no known vulnerabilities. The AGPL v3 license is the main consideration: acceptable for open-source and internal tools, but requires careful evaluation in proprietary contexts. Start with --dry mode to evaluate false positives in your codebase.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or higher.
- Files with syntax errors are skipped; the tool uses ast parsing and assumes it runs on the same or higher Python version as the codebase being checked.
- Low friction install with a single runtime dependency (tomli).
License · maintenance · safety
(agpl) — Licensed under AGPL v3, which requires derivative works and modifications to be distributed under the same license. Use in proprietary projects requires careful review of your distribution model.
last release 2024-08-09 (735 days) · last repo commit 2026-06-21 · 172 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 218,491 downloads/mo, #9,340 on PyPI
Alternatives
Verify before relying
pip install deadcode
deadcode .
deadcode . --fix --dry
deadcode . --fix --only foo.py- Whether the tool handles dynamic code patterns (e.g., getattr, __import__) or only static AST analysis
- Performance characteristics on large codebases (time, memory, CPU consumption)
- Accuracy of false-positive filtering with the various ignore options in real-world projects
What it is and what it does
Deadcode is a static analysis tool that identifies unused code at the module level across a Python codebase. Unlike linters such as ruff or flake8 which only detect unused local variables, deadcode finds global-scope dead code: unused variables, functions, classes, methods, attributes, imports, properties, and empty files. It can also detect unreachable code blocks and commented-out code. The tool runs as a command-line scanner and optionally removes detected dead code automatically.
It integrates with pyproject.toml for configuration and supports fine-grained filtering through command-line options and inline noqa comments. You can exclude directories, ignore specific names or patterns, skip code in certain files, and ignore definitions that inherit from particular base classes or use specific decorators. The tool is designed to complement other static checkers rather than replace them.
Use it for
- Clean up legacy codebases by identifying and removing unused functions, classes, and variables across the entire project
- Automate code hygiene in CI/CD pipelines by detecting dead code and optionally fixing it with --fix
- Reduce false positives from other linters by filtering out test base classes, mixins, and framework-specific patterns
- Find empty Python files and unreachable code blocks after refactoring
- Maintain code quality in large teams by catching accumulated dead code before it accumulates further
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need global-scope dead code detection.
The tool fills a gap that ruff and flake8 don't cover, has low install friction, active maintenance, and no known vulnerabilities. The AGPL v3 license is the main consideration: acceptable for open-source and internal tools, but requires careful evaluation in proprietary contexts. Start with --dry mode to evaluate false positives in your codebase.
Install
deadcode on PyPI
Before you install
Low friction install with a single runtime dependency (tomli). Actively maintained with recent commits; marked as Alpha status but in active development.
Requires Python 3.10 or higher. Files with syntax errors are skipped; the tool uses ast parsing and assumes it runs on the same or higher Python version as the codebase being checked.
License in practice
Licensed under AGPL v3, which requires derivative works and modifications to be distributed under the same license. Use in proprietary projects requires careful review of your distribution model.
Quickstart
pip install deadcode
deadcode .
deadcode . --fix --dry
deadcode . --fix --only foo.py
Verify before relying
- Whether the tool handles dynamic code patterns (e.g., getattr, __import__) or only static AST analysis
- Performance characteristics on large codebases (time, memory, CPU consumption)
- Accuracy of false-positive filtering with the various ignore options in real-world projects
Package facts
| License | Not declared agpl |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagetomli |
| Maintenance | Actively maintained 735 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 218,491 / month, #9,340 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 3 - AlphaLicense :: OSI Approved :: GNU Affero General Public License v3Natural Language :: EnglishOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12 |
Evidence: deadcode-2.4.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “find unused code python”
- deadcodeScans Python codebases to find and optionally remove unused…
- uncalledDetects unused functions in Python projects using regular expressions…
- vultureVulture is a static code analyzer that finds unused code in Python…
Give your agent the search over MCP, or paste the wish link into any chat.
More Quality Assurance packages
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
Ruff is a Python linter and code formatter written in Rust that combines linting, formatting, and code fixing into a single tool, replacing Flake8, Black, isort, and related utilities.
Pexpect spawns and controls interactive console applications by sending input and matching output patterns, automating tasks that would otherwise require manual interaction.
Black reformats Python source code to a consistent style by parsing entire files and rewriting them according to an opinionated, deterministic set of rules, eliminating manual formatting decisions.
pytest-xdist distributes pytest tests across multiple CPU cores or machines to speed up test execution, with the simplest usage being `pytest -n auto` to spawn workers equal to available CPUs.
Install it if your test suite takes long enough that parallelization would save meaningful time.
Validates AWS CloudFormation templates in YAML or JSON format against resource provider schemas and best practices, checking property values and configuration correctness.
Install it if you work with CloudFormation templates.
See also refurb · uncalled · vulture · autoflake · eradicate · yesqa · cppclean · fawltydeps · pytest-unused-fixtures · flake8-unused-arguments