Eradicate is a Python library and command-line tool designed to remove commented-out code from Python files. It identifies block comments that contain valid Python syntax, which are likely to be old, commented-out code, helping to clean up repositories. It aims to avoid false positives by intelligently detecting code patterns within comments. The library is actively maintained, with version 3.0.1 released recently, focusing on Python version compatibility and continuous improvements.
pip install eradicateVerified import paths — ran on the pinned version, not inferred.
Eradicate is predominantly used as a command-line tool. This example demonstrates how to create a sample Python file with commented-out code and then use `eradicate --in-place` to clean it up. The `--in-place` flag modifies the file directly.
Upgrade to Python 3.9 or newer, or pin `eradicate` to a version prior to 3.0.0 (e.g., `pip install 'eradicate<3.0.0'`).
Review your code for direct imports and usage of `eradicate`'s internal modules. Prefer using the command-line interface or integrations like `flake8-eradicate` if possible. If programmatic use is necessary, consult the `eradicate` source for the updated API.
Utilize the `--whitelist` or `--whitelist-extend` CLI options to specify regex patterns for comments that should always be ignored or preserved. Review changes carefully after running `eradicate`.
Install the library using pip: `pip install eradicate`
Ensure `eradicate` is installed and its script is in your PATH. Alternatively, run it using the Python module runner: `python -m eradicate <your_file.py>`
Double-check the spelling and the absolute or relative path to the file/directory you want to process. Ensure the file exists before running the command.
Upgrade your Python environment to 3.9 or newer (`eradicate` 3.x requires Python 3.9+). If upgrading Python is not an option, you must pin `eradicate` to an older compatible version: `pip install 'eradicate<3.0.0'`.
No dependency data recorded yet.