Add your description here
Project description
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
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 dep_prune-0.1.0.tar.gz.
File metadata
- Download URL: dep_prune-0.1.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
565ca9b1c80305e601a70233ba4351960aa877fd86b7878c79cefd4d86e4ada2
|
|
| MD5 |
6a0883b5f44efbf2dd6f0aeea656bd3a
|
|
| BLAKE2b-256 |
3b062415b28494f4ef3f1c09dbe0c3d81ebe0de48cab92aa4396b0f8db31d515
|
File details
Details for the file dep_prune-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dep_prune-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce3f5e5083398ce024790222eaeb5841c31537eec850ba1894adc47631dcf61b
|
|
| MD5 |
4eaf5e6bfe74b6f6ff5973428901c021
|
|
| BLAKE2b-256 |
47e9e193a82b989592a6db9cc4c729cb96ff66376faff4ef3c131d39885da70c
|