Skip to main content

Add your description here

Project description

dep-prune

A tool to analyze your Python project's dependencies and identify unused imports.

  1. Reads pyproject.toml - Supports multiple formats:

    • Poetry (tool.poetry.dependencies)
    • PEP 621 standard (project.dependencies)
    • PDM format
    • Handles dev dependencies and optional/group dependencies
  2. Scans all Python files - Recursively finds all .py files in your project

    • Automatically excludes common directories (.git, __pycache__, venv, etc.)
    • Uses AST parsing for accurate import detection
  3. Extracts imports - Finds all:

    • Regular imports: import package
    • From imports: from package import something
    • Handles nested modules correctly

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


Download files

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

Source Distribution

dep_prune-0.2.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

dep_prune-0.2.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file dep_prune-0.2.0.tar.gz.

File metadata

  • Download URL: dep_prune-0.2.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.0

File hashes

Hashes for dep_prune-0.2.0.tar.gz
Algorithm Hash digest
SHA256 302cde18af769ffb32cc7ca988edc69b072a5d9596fcc90332462017c79912b0
MD5 cca6fe12760889aa712855ec4850328a
BLAKE2b-256 960ea80aa0260d95dc10319924ba60a22e484f6cff1fc757c3e7b14543de6c15

See more details on using hashes here.

File details

Details for the file dep_prune-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: dep_prune-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.0

File hashes

Hashes for dep_prune-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad3c0aa50e88fc4605c581eeabd02f6d998ad6451f7d262460898de626809714
MD5 ec660cab840438ec5afb9cc2cff35d1c
BLAKE2b-256 5fbccbcec8adcd77a71773f2de2175f51fda35a91d99012507cfcc4fa36ac80f

See more details on using hashes here.

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