A command-line tool to clean Python package dependencies using Mark-Sweep garbage collection algorithm.
Project description
[English] | 中文
pip-sweep
pip-sweep is a command-line tool to clean Python package dependencies using the Mark-Sweep garbage collection algorithm.
When you uninstall large frameworks like django, running pip uninstall only removes the main package itself, leaving a large number of downstream dependencies installed in your environment, creating "dependency garbage".
pip-sweep intelligently analyzes the dependency graph of the current environment to safely identify and completely uninstall those orphaned packages that are only required by the target package and not used by any other surviving packages.
✨ Features
- 🧩 Mark-Sweep Garbage Collection: Accurate dependency propagation algorithm to prevent accidental uninstallation.
- 🛡️ System Protection: Protects
pip,setuptools,wheel, and other baseline infrastructure packages by default. - 🔍 Dry-Run Mode: Supports
-d/--dry-runto preview the uninstallation plan safely. - 💎 Multi-package Support: Clean multiple target packages at once.
- 🚀 Modern Toolchain Friendly: Full support for
uvandpipxinstant execution viauvxandpipx run.
🚀 Quick Start
No need to install globally, you can run it directly using modern package managers:
# Using uvx (Recommended)
uvx --from . pip-sweep headroom-ai
# Using pipx
pipx run --spec . pip-sweep headroom-ai
💻 Installation
To install pip-sweep globally:
pipx install .
📖 Command-line Usage
usage: pip-sweep [-h] [-d] [-y] [-v] packages [packages ...]
pip-sweep: A Python dependency cleaner using Mark-Sweep garbage collection algorithm.
positional arguments:
packages One or more target Python packages to clean
options:
-h, --help Show this help message and exit
-d, --dry-run Analyze and print the clean plan only, without actual uninstallation
-y, --yes Automatically confirm the uninstallation plan, skipping confirmation prompts
-v, --verbose Verbose output, showing kept packages and their specific reasons
--version Show program's version number and exit
🔧 Local Development
To debug or contribute to the project locally:
# Clone the repository
git clone https://github.com/yourusername/pip-sweep.git
cd pip-sweep
# Create venv and install in editable mode
uv pip install -e .
📝 License
MIT License © 2026 pip-sweep developers
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pip_sweep-0.1.0.tar.gz.
File metadata
- Download URL: pip_sweep-0.1.0.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
696acca0cf5190d9375f035ede399e52cbbd564f06e8fdf6208b7bddac852e41
|
|
| MD5 |
4ac57e8333372621ec53b424fadf3ac3
|
|
| BLAKE2b-256 |
cf5c5eb5100350a5e402dc34200e8c1b310adda688f7304e6361f4a96398973b
|
Provenance
The following attestation bundles were made for pip_sweep-0.1.0.tar.gz:
Publisher:
publish.yml on abevol/pip-sweep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pip_sweep-0.1.0.tar.gz -
Subject digest:
696acca0cf5190d9375f035ede399e52cbbd564f06e8fdf6208b7bddac852e41 - Sigstore transparency entry: 1873319414
- Sigstore integration time:
-
Permalink:
abevol/pip-sweep@35a860958bc7deb2749ee708d5e6f14d662031ec -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/abevol
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@35a860958bc7deb2749ee708d5e6f14d662031ec -
Trigger Event:
push
-
Statement type:
File details
Details for the file pip_sweep-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pip_sweep-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11f5d16a41ffdb19e2541d0a0c4e5fa81933a1c8b5c9603e9a81edf65dc942c5
|
|
| MD5 |
c1c1025457e4d7f6404319ffcd12850b
|
|
| BLAKE2b-256 |
17e92605f553dd2a091d6099d126b32da47579f090a32c456690a05473f8657f
|
Provenance
The following attestation bundles were made for pip_sweep-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on abevol/pip-sweep
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pip_sweep-0.1.0-py3-none-any.whl -
Subject digest:
11f5d16a41ffdb19e2541d0a0c4e5fa81933a1c8b5c9603e9a81edf65dc942c5 - Sigstore transparency entry: 1873319530
- Sigstore integration time:
-
Permalink:
abevol/pip-sweep@35a860958bc7deb2749ee708d5e6f14d662031ec -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/abevol
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@35a860958bc7deb2749ee708d5e6f14d662031ec -
Trigger Event:
push
-
Statement type: