-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[FR] Add some warnings if the package has entry-points which don't appear to resolve anywhere #3987
Comments
I'm not sure this would be a good idea, as a project's entry point does not have to refer to a module installed by the project itself. It would be a module from a dependency. Moreover, you can't reliably check if an attribute is defined in a module without importing said module, which might not be possible due to missing dependencies. It might also involve side effects. |
@SpecLad Can you give an example of a distribution which defines an entrypoint resolved within a dependency instead of within the project itself? I don't think I've ever seen that done. Regarding checking for attributes, I addressed this in the third bullet point above. Setuptools already does this with its |
This is especially useful for |
@abravalheri Hmm, I have instead used But, point taken - how about a way for user to opt-in to checking for resolvable entry-points, similar to the |
I have thought about that in the past, but I think it is actually better to block the name to avoid attacks caused by name confusion. Anyway, a whole different discussion...
I have no problem in adding support for that (if someone is interested in contributing :P)1. Something that I noticed however is that there has been an increase in request for setuptools trying to pre-emptively catch misconfuration or correct common user mistakes. While I think that is very useful and nice, there is a complicated balance in terms of maintenance efforts. Maintaining and evolving code that has been created with excessively defensive code can be a pain in the neck 😅 (and the complexity/size of the code base tends to increase). An alternative to that would be for projects whose primary goal is to run checks (like linters and pre-commit hooks) to implement some of those checks. E.g. Maybe that is even an easier target, because you need to finish building the wheel to be able to validate these entry-points (e.g. binary extensions). So it is not like setuptools can halt the build while processing the config... Footnotes
|
Yep, I see where you're coming from. It also sounds like a good feature for My only comment on using a post-build check instead of a build check is the target audience would be much more limited that way. I've only heard about check-wheel-contents fairly recently, and I only starting using it a couple of months ago - it's a great tool, but (unlike setuptools) you only find it once you've already been burned 😆 |
Added jwodder/check-wheel-contents#40 but not getting any response there.. |
What's the problem this feature will solve?
It's easy to create an entry-point which doesn't actually resolve in the installed package
Describe the solution you'd like
Suppose you have a package with an entry-point:
source:
Can you spot the bug?
The build/packaging/install all works normally but the script will be unusable:
It would be nice if the build backend would log a warning saying that
mypackage:hello_world
doesn't appear to exist, to catch these kind of issues at packaging time.Alternative Solutions
No response
Additional context
packages = ["mypackage", "mypackage.subpackage"]
__getattr__
). It doesn't have to catch all pathological cases to be useful, just logging a WARNING would be helpful most of the time. The code could reuse the existing AST parsing code which attempts to find a__version__
attribute in the source.Code of Conduct
The text was updated successfully, but these errors were encountered: