Display the size of Python and Java imports inline in the editor — inspired by the Import Cost extension.
- Shows the size of imported packages inline next to
importstatements - Supports Python (
pippackages via PyPI API) and Java (Maven Central packages) - Color-coded sizes: green (small), yellow (medium), red (large)
- Caches results to avoid repeated API calls
- Configurable size thresholds per language
- Java/Python Import Cost: Clear Cache — clears the cached package size results
- Java/Python Import Cost: Toggle Decorations — temporarily show/hide inline size decorations
| Setting | Default | Description |
|---|---|---|
javaPythonImportCost.python.enabled |
true |
Show decorations for Python files |
javaPythonImportCost.java.enabled |
true |
Show decorations for Java files |
javaPythonImportCost.python.smallPackageSizeKB |
1024 |
Max KB for "small" (green) in Python |
javaPythonImportCost.python.mediumPackageSizeKB |
1048576 |
Max KB for "medium" (yellow) in Python |
javaPythonImportCost.java.smallPackageSizeKB |
400 |
Max KB for "small" (green) in Java |
javaPythonImportCost.java.mediumPackageSizeKB |
5120 |
Max KB for "medium" (yellow) in Java |
javaPythonImportCost.smallPackageColor |
#4caf50 |
Text color for small packages |
javaPythonImportCost.mediumPackageColor |
#e6b422 |
Text color for medium packages |
javaPythonImportCost.largePackageColor |
#f44336 |
Text color for large packages |
javaPythonImportCost.debounceInterval |
300 |
Debounce (ms) before recalculating after edits |
javaPythonImportCost.cacheTTL |
1800 |
Cache TTL in seconds (0 to disable) |
A key goal is to make you aware of the size of packages you're about to depend on — and to encourage using fewer or smaller dependencies when possible. In some regions (such as mainland China), downloading packages can be painfully slow, so every kilobyte counts. The cost isn't measured in money, but in patience.
- Display the total size of a dependency tree (not just the directly imported package, but all transitive dependencies as well) — under consideration.
Found a bug or have a feature idea? Please open an issue on GitHub.
I'm an undergraduate student maintaining this in my spare time — I may not respond quickly, and I might not be able to solve every issue. That said, forks are welcome and contributions are appreciated!
Initial release. Supports Python and Java import size decorators.
