-
Notifications
You must be signed in to change notification settings - Fork 35
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
Guidance on namespace packages #813
Comments
This is a question about the import system, not the packaging ecosystem. |
You can use native namespaces packages now. That's the old pre-Python 3 system. Those docs sound very old; I'm sure that statement came from when Python 2 still mattered. |
Where are those docs? |
@henryiii Looks like from the Python Packaging User Guide (surprisingly): https://packaging.python.org/en/latest/guides/packaging-namespace-packages/#pkg-resources-style-namespace-packages |
Eventually, yes. And I believe that there is also some appetite for removing
No. Please use implicit namespaces (PEP 420) whenever you can (the way to determine if you can is via tests).
If you are concerned about compatibility, you can have a look at this table: https://github.com/pypa/sample-namespace-packages/blob/master/table.md . The rule of thumb is to stick with regular installs (and not use editable installs) for better compatibility. More info on the section: https://github.com/pypa/sample-namespace-packages?tab=readme-ov-file#remarks-on-staggered-migrations. Because we are talking about deprecated functionality it is expected that packages start to move away from old methods and maintainers start to modify the codebase to adhere to PEP 420. But because tests indicate that there is some level of compatibility (as long as you stick with some rules as mentioned above), this migration can be gradual (which facilitate maintenance of large ecosystems)1. Automation tools may also be used by large ecosystem: the main change to be implemented for implicit namespaces is to remove Footnotes
|
Thanks @abravalheri that's is really helpful and gives us pointers to plan the migration. |
Problem description
Apologies in advance if this is not the right place to ask this question, but we wanted to ask for some guidance about namespace packages.
The CKAN project has an extensions system, which are essentially python modules under the
ckanext.
namespace. There are hundreds of extensions and the CKAN Tech Team only has direct control over a handful of officially supported ones under the ckan organization in GitHub.Namespace packages have historically been defined using the pkg_resources-style (actually the extension template uses the discouraged pkgutil fallback, but we will remove that).
According to the docs:
But also:
We obviously want to ensure compatibility with the existing ecosystem of extensions but also start preparing if the current way of defining namespace packages will eventually stop being supported.
Would you recommend staying put and keep using
pkg_resource.declare_namespace()
in current and new distributions?Will
pkg_resource.declare_namespace()
orpkg_resource
for that matter eventually be removed?Many thanks in advance
The text was updated successfully, but these errors were encountered: