-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Cover PEP 420 namespace packages in "Creating and discovering plugins" guide #1104
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
Comments
Guess I'm not the only one confused. See pypa/packaging-problems#321 and https://stackoverflow.com/q/59033414. |
I'm pretty sure that guide section is not refering to PEP 420 namespace packages. PRs would be welcome to improve this. |
yea |
Using namespace packages is not explicit whether it talks about native PEP 420 namespace packages, or pkg-style namespace packages.
I tried to apply it for PEP 420 namespace packages and stumbled over two issues:
First, the given example doesn't wrap
import myapp.plugin
intry
/except
, but actuallyModuleNotFoundError
should be handled because, as a core package maintainer, you can't know how many plugins will be installed at runtime. In case of zero plugins installed, how would you guarantee amyapp.plugins
namespace will exists anyways? At leastsetuptools
won't let you install empty directories.Second, the guide says
But PEP 420 explicitly requires the absence of
__init__.py
files. Then, what is a namespace-package style __init__.py in the context of PEP 420? I believe @theacodes had pkg-style namespace packages in mind when adding that sentence with #296.Could we make it either more clear the guide is not 1:1 applicable for native namespace packages, or even better, find a suggested minimal working PEP 420 example and adapt the guide accordingly?
The text was updated successfully, but these errors were encountered: