Changelog
0.5.0 (2026-04-01)
Breaking change: complete architecture rewrite.
Removed pyproject.toml dependency — Pantry now uses
importlib.metadatadirectly. Works everywhere: development, installed packages, Docker, notebooks.Removed
packagingdependency — zero external dependencies, pure stdlib.Removed dependency groups —
has_group()removed. Usehas()directly.Removed
Pantry.discover()andPantry.from_pyproject()— no longer needed.On-demand probing — nothing happens at
import pantrytime. Packages are probed on firsthas(),get(), or[]call.Added
pantry.version(pkg)— returns installed version string.report()accepts package names —pantry.report("numpy", "pandas").Recommended pattern:
if pantry.has("pkg"): import pkg— works with pipreqs and IDEs.Source reduced from ~400 to ~300 lines (one file + bootstrap).
0.4.0 (2026-03-28)
Lazy probing: external dependencies are no longer imported at
import pantrytime. Only metadata (installed? version?) is checked at startup. The actualimport_module()happens on firstget()or[]access. This makesimport pantryfast even with many heavy optional dependencies (torch, pandas, etc.)pantry.simulate_missing(*pkgs): context manager for testing fallback behavior. Temporarily hides packages sohas(),get(),[], decorator, andreport()see them as unavailable. State is restored on exit, even on exceptions.
0.3.0 (2026-03-28)
License changed from Apache 2.0 to MIT
Promoted to Beta status
Enriched README and documentation (design philosophy, troubleshooting, examples)
0.2.0 (2026-03-28)
pantry.lazy_import("dotted.path")— register own modules for deferred importBreaks circular imports: register at top level, resolve on first
pantry["path"]accessTwo-step resolution: submodules via
import_module, attributes viagetattrResults cached after first resolution
Separate from external dependency system (
has,get,reportunaffected)Bridge toward PEP 690 (Lazy Imports)
0.1.0 (2026-03-28)
First public release.
Auto-discovery of
pyproject.tomloptional-dependenciesModule-as-instance pattern:
import pantryreturns aPantryinstancepantry["pkg"]— strict import, raises if missingpantry.get("pkg")— safe import with optional defaultpantry.has(*pkgs)— variadic availability checkpantry.has_group("group")— group-level checkpantry("pkg1", "pkg2")— decorator to guard functionspantry.report()— formatted summary tableSmart module name resolution (pip name → importable name)
PEP 561 typed (
py.typedmarker)MIT license