Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>pyImportCostNew to Visual Studio Code? Get it now.
pyImportCost

pyImportCost

DunHou

|
7 installs
| (0) | Free
Calculate size of Python imports in real-time.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

pyImportCost

A Visual Studio Code extension that displays the size of Python imports in real-time.

Preview

alt text

Features

  • Real-time Size Display: Shows import package sizes next to import statements in Python files
  • Smart Package Classification: Automatically identifies standard library, third-party, and local modules
  • Color-coded Visual Indicators: Uses different colors based on package size thresholds
  • Hover Information: Displays detailed package information including type, size, and repository links
  • Configurable Size Thresholds: Customizable size levels with corresponding color labels
  • Standard Library Control: Option to show/hide standard library module sizes
  • Repository Links: Clickable links to package repositories in hover tooltips

Requirements

  • Visual Studio Code 1.85.1 or higher
  • Python environment (automatically detects the active Python interpreter)

Installation

  1. Open Visual Studio Code
  2. Go to Extensions (Ctrl+Shift+X)
  3. Search for "pyImportCost"
  4. Click Install

Extension Settings

This extension contributes the following configuration options:

Display Settings

  • pythonImportCost.display.showStdLib: Show size indicator for Python Standard Library (default: true)
  • pythonImportCost.display.showUrlInLine: Display repository URL text at the end of the line (default: false)

Color Settings

  • pythonImportCost.colors.stdlib: Color for Built-in and Standard Library modules (default: #888888)

Size Levels Configuration

  • pythonImportCost.levels: Define size thresholds and colors (order implies priority from top to bottom)
    • Default configuration:
      [
        { "max": 50, "color": "#7cc36e", "label": "Small (<50KB)" },
        { "max": 2048, "color": "#cfa344", "label": "Medium (<2MB)" },
        { "max": null, "color": "#d44e40", "label": "Large (>2MB)" }
      ]
      

Python Path Settings

  • pythonImportCost.pythonPath: Manually specify Python executable path (optional, uses active environment if empty)

Usage

  1. Open any Python file (.py)
  2. The extension automatically activates and displays package sizes next to import statements
  3. Hover over any import statement to see detailed information
  4. Click repository links in hover tooltips to open package repositories

Example

import numpy  # Displays size information here
from sklearn import datasets  # And here too

Package Types

The extension classifies packages into four types:

  • Built-in: Core Python built-in modules
  • Standard Library: Python standard library modules
  • Third-party: External packages installed via pip/conda
  • Local: Local project modules

Known Issues

  • Initial loading may take some time to fetch package size information
  • Some private or custom-installed packages may not be properly recognized
  • Network connectivity issues may affect package information retrieval
  • Large projects with many imports may experience slight performance impact

Release Notes

0.0.3

Initial release with:

  • Basic package size display functionality
  • Smart package type recognition
  • Configurable color and threshold settings
  • Hover information display
  • Repository link integration

0.0.4

  • add icon to extension

0.0.5

  • add images to readme.md
  • fix some typos
  • add license.md
  • add comments

Enjoy using pyImportCost!

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft