Creosote is a Python command-line tool designed to identify unused dependencies within a project's virtual environment. It helps prevent bloated environments by scanning Python files for imports and comparing them against the declared dependencies in various specification files like `pyproject.toml`, `requirements.txt`, PDM, and Pipenv. As of version 5.2.0, it is actively maintained with frequent releases, typically on a monthly to bi-monthly cadence.
pip install creosoteNo compatibility data collected yet for this library.
This quickstart demonstrates how to install and run Creosote to identify an unused dependency in a simple project structure using `pyproject.toml`. It sets up a virtual environment, installs Creosote and a couple of dependencies (one used, one unused), then runs Creosote to find the unused one.
Upgrade your Python environment to version 3.10 or higher. If unable to upgrade, use Creosote version <5.0.0.
Include `--sections` argument with the path to your dependency group, e.g., `--sections project.dependencies` or `--sections tool.poetry.dependencies`.
Add the `--include-deferred` flag to your Creosote command: `creosote ... --include-deferred`.
Use the `--django-settings` flag with the path to your Django settings module, e.g., `--django-settings myproject.settings`.
Ensure `creosote` is installed in your active virtual environment (`pip install creosote`) and that the virtual environment is properly activated (`source .venv/bin/activate`). Alternatively, install it with `pipx install creosote` for global access.
Upgrade your Python environment to 3.10 or newer. If you must use Python 3.9, install a compatible older version of Creosote, e.g., `pip install 'creosote<5.0.0'`.
Double-check the `--deps-file` path and the `--sections` argument for typos. Ensure the file exists and the section path is correct for your project's configuration (e.g., `project.dependencies` for PEP 621 or `tool.poetry.dependencies` for Poetry).
No dependency data recorded yet.