Fix entry-point discovery and support deferred (PEP 563) annotations - #354
Open
audivir wants to merge 3 commits into
Open
Fix entry-point discovery and support deferred (PEP 563) annotations#354audivir wants to merge 3 commits into
audivir wants to merge 3 commits into
Conversation
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.
I found two separate bugs while building a third-party converter plugin:
First, entry-point discovery was completely broken for all third-party plugins. It turns out that during the migration from
pkg_resourcestoimportlib.metadata, the code started usingentry_points(name=group_name)instead ofgroup=group_name. Becausenamefilters a different field, anything underuplink.plugins.*was being silently ignored.Second,
get_arg_specwasn't handling deferred annotations (PEP 563). Iffrom __future__ import annotationswas used,inspect.signaturereturned strings instead of actual objects, which broke the matching forBody(type=Model)and return types. This fixes #181.Changes
uplink/_extras.pyto usegroup=instead ofname=.uplink/utils.pyto useeval_str=Trueininspect.signature(which is supported since we're on Python 3.10+).Testing
uv run pytest tests/(all 411 passed).from __future__ import annotationsis present.Fixes #181.