Getting Started

Installation

pip install mypantry

Zero dependencies — only Python standard library.

First Use

import pantry

# Check if numpy is installed
print(pantry.has("numpy"))    # True or False

# Check version
print(pantry.version("numpy"))  # "1.26.4" or None

# Import safely
np = pantry.get("numpy")     # module or None

# Import strictly
np = pantry["numpy"]          # module or RuntimeError

How It Works

When you import pantry, the module replaces itself with a Pantry instance.

  • has() — checks importlib.metadata (is the distribution installed?)

  • get() / [] — imports the module lazily on first access, caches the result

  • Smart module name resolution: pillowPIL, scikit-learnsklearn

No configuration files, no startup scanning, no pyproject.toml dependency. Works in any context: dev, installed, Docker, notebooks.

Next Steps