-
-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dict construction of sequence of EntryPoint objects is unintuitive #284
Comments
In the twine issue, I attempted to implement this function:
Unfortunately, this approach led to failures in type checks, namely:
I reported the issue in python/mypy#9938, but the initial response is that this (ab)use of Python isn't supported by mypy (mypy can't be smart enough to detect that As a result, I'd like to have a better approach that still meets this very common use-case. |
Some of the requirements I've inferred from the past experience:
The current design achieves much of this through the following implementation:
The current implementation doesn't support (5) above, but instead requires the user to resolve a missed key to an empty sequence (e.g. The current implementation doesn't satisfy (6), the primary motivation for making the change. |
Exploring solutionsSequence of EntryPoint objects as classIn #278, I've explored a couple of approaches that attempt to address the concerns above, first by elevating the concept of a sequence of entry points as its own class, EntryPoints, with some interface for easily retrieving the names of the entry points and selecting the entry point with a matching name. Sequence of EntryPoint objects resolvable by groupExtending the idea of the This approach had the nice feature of being explicit about the state of resolution while resolving entry points, but also was fairly constraining and a lot of cognitive overhead. Sequence of EntryPoint objects selectable by name or groupCombining the two ideas above, I found that with the introduction of a new |
Fixed in #278. |
I am not sure if this is relevant here, I get this error, "TypeError: entry_points() got an unexpected keyword argument 'group'" |
In pypa/twine#728, I learned that the dict hack for resolving a group of entry points by name is unintuitive, violates static type checks, and still doesn't provide an elegant way to resolve a set of entry points by group and name.
Therefore, I'd like to re-consider the user-interface (API) for
entry_points()
and its objects. In particular, I want to go back to the drawing board, revisit the requirements, and design something that's simple and elegant in the general case, but also isn't constrained just to the common cases.This bug represents the motivation for creating #278 and to be more explicit about the motivations and factors driving the change.
The text was updated successfully, but these errors were encountered: