importlib_metadata 3.6 and Python 3.12 compat fix#2
Merged
Conversation
Reduce a bit of duplication by lifting out a `get_config()` helper function to a new `internal` package.
Removes some duplication between `startup.py` and `reload.py` with respect to processing the config for `ep_types`.
This centralizes the handling of importing the correct `importlib` metadata, and the logic for finding the entry points for a specific entrypoint group name.
Quoting the upstream docs: > Changed in version 3.12: The “selectable” entry points were introduced > in importlib_metadata 3.6 and Python 3.10. Prior to those changes, > entry_points accepted no parameters and always returned a dictionary of > entry points, keyed by group. With importlib_metadata 5.0 and Python > 3.12, entry_points always returns an EntryPoints object. Rather than try to gate the updated logic on both the `importlib` version and the Python version we instead update `get_entry_points()` to check whether it has a `dict` or not after calling `entry_points()` and act accordingly.
a3cfbfb to
f117bf9
Compare
Contributor
Author
|
Reworked to use |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
👋 After setting up
ldmud-efunsin a fresh venv w/ Python 3.12+ I noticed the following error at startup and no efuns/types being registered:The root cause is a breaking change described in the
importlib.metadatadocs:This branch works around that change so the package continues to work with Python 3.12+ and importlib_metadata 5.0+.
I couldn't help but tidy up some duplication commit-by-commit before implementing the fix. If you'd prefer a more minimal diff I'd be happy to rework the branch.