Sopel itself did this some time ago (sopel-irc/sopel#2261) for 8.0. The setuptools project discourages new usage of its pkg_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 find pkg_resources; the setuptools 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 add setuptools as a runtime requirement.
Like sopel itself, this plugin should probably make use of the importlib_metadata backport package instead of try/except around different ways of calling importlib.metadata.entry_points(). The simple approach (subscripting as entry_points()['name'] or using entry_points().get('name)) worked up until Python 3.12, which now always returns an EntryPoints object instead of a dict-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 the importlib-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's master branch on Windows after recent chat in our IRC channel, but *nix Python environments that don't have setuptools unless it's manually installed from the system package manager or pip also exist.
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.