A Visual Studio Code extension that displays the size of Python imports in real-time.
- 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
- Visual Studio Code 1.85.1 or higher
- Python environment (automatically detects the active Python interpreter)
- Open Visual Studio Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "pyImportCost"
- Click Install
This extension contributes the following configuration options:
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)
pythonImportCost.colors.stdlib: Color for Built-in and Standard Library modules (default: #888888)
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)" } ]
- Default configuration:
pythonImportCost.pythonPath: Manually specify Python executable path (optional, uses active environment if empty)
- Open any Python file (.py)
- The extension automatically activates and displays package sizes next to import statements
- Hover over any import statement to see detailed information
- Click repository links in hover tooltips to open package repositories
import numpy # Displays size information here
from sklearn import datasets # And here tooThe 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
- 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
Initial release with:
- Basic package size display functionality
- Smart package type recognition
- Configurable color and threshold settings
- Hover information display
- Repository link integration
- add icon to extension
- add images to readme.md
- fix some typos
- add license.md
- add comments
Enjoy using pyImportCost!
