Skip to main content

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-run to preview the uninstallation plan safely.
  • 💎 Multi-package Support: Clean multiple target packages at once.
  • 🚀 Modern Toolchain Friendly: Full support for uv and pipx instant execution via uvx and pipx 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pip_sweep-0.1.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pip_sweep-0.1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

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

Hashes for pip_sweep-0.1.0.tar.gz
Algorithm Hash digest
SHA256 696acca0cf5190d9375f035ede399e52cbbd564f06e8fdf6208b7bddac852e41
MD5 4ac57e8333372621ec53b424fadf3ac3
BLAKE2b-256 cf5c5eb5100350a5e402dc34200e8c1b310adda688f7304e6361f4a96398973b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pip_sweep-0.1.0.tar.gz:

Publisher: publish.yml on abevol/pip-sweep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for pip_sweep-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 11f5d16a41ffdb19e2541d0a0c4e5fa81933a1c8b5c9603e9a81edf65dc942c5
MD5 c1c1025457e4d7f6404319ffcd12850b
BLAKE2b-256 17e92605f553dd2a091d6099d126b32da47579f090a32c456690a05473f8657f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pip_sweep-0.1.0-py3-none-any.whl:

Publisher: publish.yml on abevol/pip-sweep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page