pkg_resources
should be replaced with importlib.metadata
#11
Labels
enhancement
New feature or request
pkg_resources
should be replaced with importlib.metadata
#11
Sopel itself did this some time ago (sopel-irc/sopel#2261) for 8.0. The
setuptools
project discourages new usage of itspkg_resources
library, and I should also note that a fresh installation of Python* raised an error when trying to load this plugin because it couldn't findpkg_resources
; thesetuptools
package wasn't installed by default, and the plugin doesn't declare it as a runtime dependency.Since using
pkg_resources
is discouraged, I'm opening an issue reminding us that a migration needs to happen instead of just making a quick PR to addsetuptools
as a runtime requirement.Like
sopel
itself, this plugin should probably make use of theimportlib_metadata
backport package instead oftry
/except
around different ways of callingimportlib.metadata.entry_points()
. The simple approach (subscripting asentry_points()['name']
or usingentry_points().get('name)
) worked up until Python 3.12, which now always returns anEntryPoints
object instead of adict
-like.The most natural time for this migration to happen, IMO, would be in the first release of
sopel-help
that no longer supports Sopel 7.x—meaning it would only need to make sure theimportlib
-based solution works on Python 3.8+ and not all the way back to py2.7.* — In this specific case I was curiously testing
sopel
'smaster
branch on Windows after recent chat in our IRC channel, but *nix Python environments that don't havesetuptools
unless it's manually installed from the system package manager orpip
also exist.The text was updated successfully, but these errors were encountered: