Skip to content
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

Sopel should deprecate sopel_modules namespace packages #2622

Open
dgw opened this issue Sep 17, 2024 · 0 comments
Open

Sopel should deprecate sopel_modules namespace packages #2622

dgw opened this issue Sep 17, 2024 · 0 comments
Labels
Housekeeping Code cleanup, removal of deprecated stuff, etc. Long-term Planning Things that need to happen at some point in the future, but need to NOT happen soon.
Milestone

Comments

@dgw
Copy link
Member

dgw commented Sep 17, 2024

Existing packages in the sopel_modules namespace almost exclusively date back to the days of declaring a namespace using pkg_resources, and that module is deprecated. I'm just giving us a reminder for "someday".

The packaging documentation talks about legacy namespace packages and outlines cross-compatibility issues with the different methods of declaring them: https://packaging.python.org/en/latest/guides/packaging-namespace-packages/#legacy-namespace-packages

pkg_resources namespaces cannot coexist with implicit namespaces or pkgutil namespaces. In addition, even within each convention, the namespace logic can be broken by one installed package that doesn't follow the rules. (This would be a big part of why we started pushing entry-points as the future. A misconfigured entry point just doesn't work, but a misconfigured namespace package can break the whole namespace.)

This is why I suggest we deprecate the sopel_modules namespace starting in Sopel 8.1. I think there should be a deprecation warning when loading a sopel_modules plugin, just as there is when loading a plugin that still imports sopel.module.

sopel-irc/cookiecutter-sopel already discourages new namespace packages; the template now uses entry-point style. Packages' names will have to change no matter what, whether to switch to an entry point or to change namespaces—and thus I am not suggesting that we add support for a newer sopel_plugins namespace in which packages would be expected to follow the "implicit" or "pkgutils" style.

Having done a number of namespace-to-entry-point migrations myself, I'm confident in saying that it isn't very hard. Most of the time I spend on those migrations tends to be on making sure the package metadata is correctly moved to pyproject.toml, which I do at the same time, and not on changing the package structure.

@dgw dgw added Long-term Planning Things that need to happen at some point in the future, but need to NOT happen soon. Housekeeping Code cleanup, removal of deprecated stuff, etc. labels Sep 17, 2024
@dgw dgw added this to the 8.1.0 milestone Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Housekeeping Code cleanup, removal of deprecated stuff, etc. Long-term Planning Things that need to happen at some point in the future, but need to NOT happen soon.
Projects
None yet
Development

No branches or pull requests

1 participant