saturnin.lib.metadata¶
Utility functions for interacting with Python’s importlib.metadata.
This module provides helper functions to simplify common tasks related to
discovering and inspecting package distributions and their registered entry points,
acting as a focused interface to importlib.metadata functionalities.
Functions¶
- saturnin.lib.metadata.iter_entry_points(group: str, name: str | None = None) Generator[EntryPoint, None, None][source]¶
Provides an iterator for entry points, similar to
pkg_resources.iter_entry_points.This function leverages
importlib.metadata.entry_points()to find and yieldEntryPointobjects.- Parameters:
- Yields:
EntryPoint– AnEntryPointobject for each matching entry point found.- Return type:
Generator[EntryPoint, None, None]
- saturnin.lib.metadata.get_entry_point_distribution(entry_point: EntryPoint) Distribution | None[source]¶
Finds the distribution package that registered a given entry point.
This function iterates through all available distributions to find the one containing the specified
entry_point. It is not limited to distributions that might have registered specific Saturnin components but searches globally.- Parameters:
entry_point (EntryPoint) – The
EntryPointobject for which the parent distribution is to be located.- Returns:
- The
Distributionobject that registered the entry_point, orNoneif no such distribution can be found.
- The
- Return type:
Distribution | None