dep-prune
A tool to analyze your Python project's dependencies and identify unused imports.
-
Reads pyproject.toml - Supports multiple formats:
- Poetry (
tool.poetry.dependencies) - PEP 621 standard (
project.dependencies) - PDM format
- Handles dev dependencies and optional/group dependencies
- Poetry (
-
Scans all Python files - Recursively finds all
.pyfiles in your project- Automatically excludes common directories (
.git,__pycache__,venv, etc.) - Uses AST parsing for accurate import detection
- Automatically excludes common directories (
-
Extracts imports - Finds all:
- Regular imports:
import package - From imports:
from package import something - Handles nested modules correctly
- Regular imports:
Usage:
# Basic usage (analyze current directory)
uvx dep-prune
# Analyze specific directory
uvx dep-prune /path/to/project
# Specify custom pyproject.toml location
uvx dep-prune --pyproject /custom/path/pyproject.toml
# Verbose mode for detailed output
uvx dep-prune -v
Installation:
You'll need to install the toml package to run this tool:
pip install toml
Example Output:
Analyzing project at: /path/to/project
Reading pyproject.toml from: /path/to/project/pyproject.toml
Found dependency groups:
main: 15 packages
dev: 8 packages
Found 127 Python files
============================================================
Analyzing main dependencies:
============================================================
✓ Used packages (12):
• flask
• numpy
• pandas
• requests
⚠ Potentially unused packages (3):
• some-unused-lib
• another-unused-package
• legacy-dependency
Summary for main:
Total: 15
Used: 12
Potentially unused: 3
Metadata
Release files for dep-prune 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dep_prune-0.2.0.tar.gz | 6.2 kB | Without provenance | Details for dep_prune-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dep_prune-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for dep_prune-0.2.0-py3-none-any.whl |
Total release size: 13.6 kB
Release files / dep_prune-0.2.0.tar.gz
| Download URL | dep_prune-0.2.0.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
302cde18af769ffb32cc7ca988edc69b072a5d9596fcc90332462017c79912b0
|
|
BLAKE2b-256 checksum How to use checksums |
960ea80aa0260d95dc10319924ba60a22e484f6cff1fc757c3e7b14543de6c15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.0
|
Release files / dep_prune-0.2.0-py3-none-any.whl
| Download URL | dep_prune-0.2.0-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad3c0aa50e88fc4605c581eeabd02f6d998ad6451f7d262460898de626809714
|
|
BLAKE2b-256 checksum How to use checksums |
5fbccbcec8adcd77a71773f2de2175f51fda35a91d99012507cfcc4fa36ac80f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.0
|
Security for dep-prune 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.