You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sync with importlib_metadata for Python 3.16 #160386
Shared protocols for consumers.IDistribution and IPackagePath join
the existing PackageMetadata in _meta.py, and the functions returning
distributions and files are annotated with them. A consumer can target one
interface across importlib.metadata and the backport instead of either
library's concrete classes, which is what a custom provider's objects
require: the provider serves consumers of both libraries and cannot subclass
its way into satisfying both (API incompatibility with importlib.metadata (or at least the API is not type-safe?) importlib_metadata#486, Enforce local versions of objects and introduce shared protocols importlib_metadata#505). All three protocols are @runtime_checkable, so isinstance answers the question without
evaluating a distribution's properties on 3.12 and later.
What does not come downstream is the other half of that release. The backport
substitutes its own classes for the importlib.metadata objects a provider
supplies, and warns where a provider's class omits a member IDistribution
requires; both live in its _compat package, which is excluded from the
port. Only the protocols those mechanisms are defined against are synced, so
the guidance for providers is documented here as the backport's behavior
(Expand documentation for importlib.metadata custom providers to include caveats regarding backports #123976).
Activity
gh-160386: Apply changes from importlib_metadata 9.1 (#160387)
pythongh-160386: Apply changes from importlib_metadata 10.0