Skip to main content

Analyse Python virtual environments — size, health, deps, and more.

Project description

VenvDoctor 🩺

Analyze, visualize, and optimize Python virtual environments.

VenvDoctor is a command-line utility that helps Python developers understand virtual environment storage usage, inspect package dependencies, detect outdated packages, discover duplicate packages across environments, and generate interactive reports.

Whether you're working with machine learning projects, data science workloads, web applications, or dozens of development environments, VenvDoctor helps answer one simple question:

Where is my disk space going?


Why VenvDoctor?

Python virtual environments are essential for dependency isolation, but they often become invisible storage consumers.

A typical development machine may contain:

  • Multiple virtual environments
  • Duplicate copies of large packages
  • Unused environments consuming gigabytes of storage
  • Outdated packages
  • Hidden dependency bloat

Traditional tools such as:

pip list
pip show
pip freeze

provide package information, but they don't help you understand:

  • Storage usage
  • Package size distribution
  • Cross-environment duplication
  • Dependency impact
  • Environment-level analytics

VenvDoctor fills that gap.


Key Features

Environment Analytics

  • Analyze active virtual environments
  • Analyze any virtual environment by path
  • Calculate package-level storage usage
  • Identify the largest packages
  • Measure total environment size

Dependency Intelligence

  • Dependency tree visualization
  • Dependency impact analysis
  • Package inspection
  • Package metadata analysis

Reporting & Visualization

  • JSON export
  • CSV export
  • Interactive HTML dashboards
  • Storage distribution charts
  • Duplicate package dashboards

Multi-Environment Analysis

  • Scan directories for virtual environments
  • Detect duplicate packages
  • Estimate recoverable storage
  • Compare environments
  • Cleanup recommendations

Package Maintenance

  • Detect outdated packages using the PyPI API
  • Review installed vs latest versions

Screenshots

Environment Dashboard

Environment Dashboard

Environment Dashboard


Duplicate Storage Dashboard

Duplicate Dashboard

Duplicate Dashboard


Installation

From Source

git clone https://github.com/venkat24k/venvdoctor.git

cd venvdoctor

python -m venv venv

venv\Scripts\activate

pip install -e .

Quick Start

Analyze Current Environment

venvdoctor

Example:

VenvDoctor
==================================================

Python Version    : 3.14.4
Environment Path  : D:\Projects\venvdoctor\venv

Installed Packages: 42
Environment Size  : 4.62 GB

Top Packages By Disk Usage
==================================================

torch                 3.24 GB (70.1%)
tensorflow            1.12 GB (24.2%)
numpy               148.27 MB (3.2%)

Commands

Show Top Packages

venvdoctor --top 5

Display the largest packages by disk usage.


Analyze Any Virtual Environment

venvdoctor --venv "D:\Projects\MLProject\venv"

Analyze a virtual environment without activating it.


Export JSON

venvdoctor --json

Generate machine-readable output.

Example:

{
  "package_count": 42,
  "environment_size": "4.62 GB"
}

Generate Reports

JSON Report

venvdoctor --report report.json

CSV Report

venvdoctor --report report.csv

HTML Dashboard

venvdoctor --html dashboard.html

Generates an interactive dashboard showing:

  • Environment summary
  • Package count
  • Largest package
  • Storage distribution
  • Package usage table

Dependency Tree

venvdoctor --tree

Example:

pandas
├── numpy
├── python-dateutil
└── pytz

Package Inspection

venvdoctor --package numpy

Displays:

  • Version
  • Size
  • Installation location
  • Dependencies
  • Package summary

Dependency Impact Analysis

venvdoctor --largest-deps

Ranks packages by:

Own Size + Dependency Size

Useful for identifying packages that indirectly contribute large storage costs.


Outdated Package Detection

venvdoctor --outdated

Example:

Package             Installed    Latest

pip                   26.0.1     26.1.2

Multi-Environment Analysis

One of VenvDoctor's most powerful capabilities.


Scan for Virtual Environments

venvdoctor scan "D:\Projects"

Example:

Found 4 Virtual Environment(s)

NLP\venv                 4.62 GB
streamlit_practice\venv  333.36 MB
venvdoctor\venv           11.05 MB

Total Storage Used: 4.97 GB

Duplicate Package Detection

venvdoctor scan "D:\Projects" --duplicates

Example:

numpy installed in 2 environments
Potential save: 51.51 MB

pandas installed in 2 environments
Potential save: 62.69 MB

This helps identify package duplication across multiple environments.


Duplicate Storage Dashboard

Generate a visual dashboard showing duplicate package usage.

venvdoctor scan "D:\Projects" --duplicates-html duplicates.html

The dashboard includes:

  • Duplicate package count
  • Combined duplicate storage
  • Potential storage savings
  • Duplicate distribution charts
  • Package presence matrix
  • Detailed duplicate package breakdown

Example insights:

Duplicate Packages : 11
Combined Size      : 317.51 MB
Potential Savings  : 166.16 MB
Environments       : 4

Cleanup Recommendations

venvdoctor scan "D:\Projects" --cleanup

Example:

Cleanup Candidates

old_ml_project\venv
Size: 4.8 GB
Last Modified: 180 days ago

Custom threshold:

venvdoctor scan "D:\Projects" --days-old 60

Architecture

User
 │
 ▼
CLI Interface (cli.py)
 │
 ├── Package Analyzer
 │     └── package_analyzer.py
 │
 ├── Dependency Analysis
 │     └── tree.py
 │
 ├── Outdated Package Checker
 │     └── outdated.py
 │
 ├── Multi-Venv Scanner
 │     └── scanner.py
 │
 ├── HTML Dashboard Generator
 │     └── formatters.py
 │
 └── Duplicate Dashboard Generator
       └── formatters_duplicates.py

                │
                ▼

       Python Virtual Environments

Technology Stack

  • Python 3.10+
  • argparse
  • pathlib
  • importlib.metadata
  • json
  • csv
  • concurrent.futures

Roadmap

Planned

Future Enhancements

  • Environment comparison
  • Interactive dashboard mode
  • Export duplicate analysis to JSON/CSV

Built to help developers understand, manage, and optimize Python virtual environments.

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

venvdoctor-1.0.0.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

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

venvdoctor-1.0.0-py3-none-any.whl (25.3 kB view details)

Uploaded Python 3

File details

Details for the file venvdoctor-1.0.0.tar.gz.

File metadata

  • Download URL: venvdoctor-1.0.0.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for venvdoctor-1.0.0.tar.gz
Algorithm Hash digest
SHA256 b43728d0e2586162a80113e33993cf7529df9ca3792ee3b4b9675d94644c561c
MD5 9f16bee184656ad7353ea0ec1f28d36b
BLAKE2b-256 05b474f762d67e8e9fee4e29f39132d2d6af9cf7d552033289ffe28bc0908b21

See more details on using hashes here.

File details

Details for the file venvdoctor-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: venvdoctor-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 25.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for venvdoctor-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e0d0b02cf0684d15ca9974ca53891a04633ae23c69896a68f3981043dd5e663
MD5 b3a72bc482bc7df98cab4bb3312b40da
BLAKE2b-256 cb827a76253d6c193c6323e397435bcae368496b7e122309e1defd6669549bc5

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