{"id":25939229,"url":"https://github.com/samso9th/pip-cleanup","last_synced_at":"2026-05-29T01:32:31.787Z","repository":{"id":280068655,"uuid":"940891172","full_name":"Samso9th/pip-cleanup","owner":"Samso9th","description":"A smart Python package cleanup tool that scans your project for unused pip packages.","archived":false,"fork":false,"pushed_at":"2025-03-01T02:43:52.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-01T03:20:25.003Z","etag":null,"topics":["pip","python","python3"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/pip-cleanup","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Samso9th.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-01T02:03:53.000Z","updated_at":"2025-03-01T02:42:54.000Z","dependencies_parsed_at":"2025-03-01T03:31:44.305Z","dependency_job_id":null,"html_url":"https://github.com/Samso9th/pip-cleanup","commit_stats":null,"previous_names":["samso9th/pip-cleanup"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Samso9th%2Fpip-cleanup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Samso9th%2Fpip-cleanup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Samso9th%2Fpip-cleanup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Samso9th%2Fpip-cleanup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Samso9th","download_url":"https://codeload.github.com/Samso9th/pip-cleanup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241780495,"owners_count":20019061,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pip","python","python3"],"created_at":"2025-03-04T04:16:03.229Z","updated_at":"2026-05-29T01:32:31.750Z","avatar_url":"https://github.com/Samso9th.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pip-cleanup \n\nA Python tool to clean up unused pip packages from your Python environment.\n\n## Features\n\n- Scans your Python project for imported packages\n- Compares against installed packages\n- Identifies unused dependencies\n- Interactive removal of unused packages\n- Generates requirements.txt with only used packages\n- Supports JSON output for automation\n- Configurable directory exclusions and package ignores\n\n## Installation\n\n```bash\npip install pip-cleanup\n```\n\nLinux/MacOS users can also install using pipx for better isolation:\n\n```bash\npipx install pip-cleanup\n```\n\n## Usage\n\n1. Navigate to your Python project directory or activated environment\n\n2. Run pip-cleanup:\n\n```bash\npip-cleanup\n```\n\n### Available Options\n\n```bash\n# Show help message and available options\npip-cleanup --help\n\n# Check version (any of these work)\npip-cleanup -v\npip-cleanup --version\n\n# Scan a specific directory\npip-cleanup --path /path/to/project\npip-cleanup -p /path/to/project\n\n# Exclude directories from scanning\npip-cleanup --exclude tests --exclude docs\npip-cleanup -e tests -e docs\n\n# Ignore specific packages\npip-cleanup --ignore pytest --ignore black\npip-cleanup -i pytest -i black\n\n# Generate requirements.txt with only used packages\npip-cleanup --requirements\npip-cleanup -r\n\n# Output in JSON format (useful for scripting)\npip-cleanup --json\n\n# Scan system for all Python environments and choose one\npip-cleanup --deep\npip-cleanup -d\n\n# Show detailed logs during deep environment scanning (requires --deep)\npip-cleanup -d --logs\npip-cleanup --deep -l\n\n# Suppress non-essential output\npip-cleanup --quiet\npip-cleanup -q\n```\n\n### How It Works\n\n1. **Project Scanning**: The tool scans your Python files for import statements\n2. **Package Analysis**: Compares found imports against installed packages\n3. **Smart Detection**: \n   - Handles both direct imports (import numpy) and from imports (from PIL import Image)\n   - Recognizes common package aliases (e.g., PIL -\u003e pillow)\n   - Excludes standard library packages\n4. **Interactive Cleanup**: Lets you choose which packages to remove\n5. **Requirements Generation**: Can create requirements.txt with only used packages\n6. **JSON Output**: Can return output in parsable JSON format for development/automation purposes\n\n## Example Output\n\n```\n╔═══════════════════════════════════════╗\n║          📦 PIP-CLEANUP 📦           ║\n║    Find and remove unused packages    ║\n╚═══════════════════════════════════════╝\n\n💻 Pip package remover tool by @samso9th\n\n🔍 Scanning for installed packages...\n🔍 Scanning for imports in your code...\n🔍 Checking project requirements...\n\n+-----+--------------------+-------------+---------+\n|   # | Package            | Version     | Size    |\n+=====+====================+=============+=========+\n|   1 | numpy              | 2.2.3       | 34.4MB  |\n+-----+--------------------+-------------+---------+\n|   2 | pandas             | 2.2.3       | 43.1MB  |\n+-----+--------------------+-------------+---------+\n|   3 | requests           | 2.32.3      | 408.7KB |\n+-----+--------------------+-------------+---------+\n\nEnter package numbers to uninstall (comma-separated, e.g. 1,3,5), 'all', or 'q' to quit:\n```\n\nYou can:\n- Enter numbers like `1,2` to select specific packages\n- Type `all` to select all packages\n- Type `q` to quit without uninstalling\n\n## Notes\n\n- Essential packages (pip, setuptools, wheel) are automatically excluded\n- The tool respects your project's requirements.txt and setup.py dependencies\n- Virtual environment friendly - works with both global and virtual environments\n- Use --exclude to skip test directories or other non-relevant code\n- Use --ignore to keep packages that might be used indirectly\n- Use --json for integration with other tools or scripts.\n- Use --requirements to update your requirements.txt automatically.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit issues and pull requests, as it will make the project better.\n\n## License\n\nMIT License","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamso9th%2Fpip-cleanup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamso9th%2Fpip-cleanup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamso9th%2Fpip-cleanup/lists"}