pkgutil
pkgutil is a module in Python's standard library that provides utilities related to the import system and package discovery. It offers helpers for inspecting packages, finding modules, and accessing package resources. It is used by tooling that analyzes package contents, discovers modules, and supports certain types of namespace packaging.
The module's core capabilities include utilities for module discovery. The iter_modules(path=None, prefix='') function yields information about
In addition to discovery, pkgutil provides access to resources inside packages. The get_data(package, resource) function returns
Other utilities related to import and packaging include get_loader(fullname), which returns a loader object for a
Overall, pkgutil provides lightweight tools for exploring package structures and accessing embedded resources, often serving as