--- id: eradicate version: "3.0.1" license: Expat License license_treatment: permissive maintenance: active --- # eradicate — Removes commented-out code. License: permissive · Maintenance: active · Downloads: 972.2K/mo ## What it is and what it does Eradicate is a command-line tool that scans Python source files for block comments containing valid Python syntax and removes those likely to be commented-out code. It uses heuristics to avoid false positives—for example, it won't remove comments that are natural language sentences. The tool is designed for teams using modern version control who want to clean up accumulated commented-out code without manually reviewing each instance. The package works by analyzing comment blocks for Python syntax patterns and filtering out obvious non-code comments. It includes a whitelist feature to handle false positives by allowing users to specify regex patterns (via --whitelist or --whitelist-extend) that should be preserved. It integrates with linting workflows and has companion plugins for flake8 and other tools. Use it for: - Clean up legacy codebases that accumulated commented-out code over time before committing to version control - Enforce code cleanliness in CI/CD pipelines by detecting and removing dead comments automatically - Prepare code for code review by removing noise and improving readability of comment sections - Integrate with pre-commit hooks to prevent commented-out code from entering the repository - Audit existing Python projects to identify and remove debugging or experimental code left as comments ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Eradicate detects and removes commented-out code from Python files while preserving legitimate comments, using heuristics to distinguish between the two. Yes. Eradicate is a lightweight, actively maintained tool with zero dependencies, permissive licensing, and a clear single purpose. It's useful for teams that want to enforce clean code practices and remove commented-out code at scale. Install it if you maintain Python codebases and want to automate comment cleanup; the low friction and focused scope make it a low-risk addition to your workflow. ## Install pip install eradicate uv add eradicate poetry add eradicate ## Installing eradicate Before you install: Low install friction with no runtime dependencies. Actively maintained as of 2025-10-27 with recent commits and a stable repository. License in practice: Licensed under the Expat License (MIT equivalent), a permissive license that allows free use, modification, and distribution with minimal restrictions. Quickstart: pip install eradicate eradicate --in-place example.py Verify before relying: - Accuracy of heuristics for distinguishing commented code from legitimate comments in edge cases - Performance characteristics on large codebases or files with many comments ## Package facts - License: Expat License (permissive) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 972.2K/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags remove commented code, clean up commented-out code, detect dead code comments, python code cleanup tool, commented code removal, code comment sanitizer, dead code detection, code-cleanup, linting-adjacent [View on SkillFed](https://skillfed.io/packages/eradicate) · [View on PyPI](https://pypi.org/project/eradicate/)