Update djblets.extensions to drop usage of pkg_resources.
Review Request #13100 — Created June 6, 2023 and submitted — Latest diff uploaded
pkg_resources
has long been deprecated, but until recently has
remained consistent in behavior. The replacements can be found in
importlib.resources
,importlib.metadata
, andpackaging
modules.Over time,
pkg_resources
began to wrap newer versions of some of these
modules, breaking backwards-compatibility. While not ideal, it's
incentive to move toward the modern packaging support in Python.This change updates
djblets.extensions
to (almost) fully move to these
new packages. In some cases, the updates are fairly straight-forward,
but in others there's some rewriting that needs to take place:
-
Version parsing is now strict, so we need to better bullet-proof
against parsing issues. -
Metadata is now handled by
importlib.metadata
, allowing us to remove
a bunch of old code. -
The old extension package installation code had to be wired off. This
was never truly supported, couldn't install wheels, and had a big
scary warning in the docs, so we're not going through a deprecation
cycle for this.
The packaging support still uses pkg_resources
, as that's what
setuptools.Command
uses. This will need to be converted in time.
There may be some fallout from this change, as there may be behavioral
differences in results/error handling in some cases. If any issues come
up from this change, we'll need to identify the differences and
proactively address them.
Djblets and Review Board unit tests pass. Tested on Python 3.7 and 3.12
with the latest versions ofpackaging
,importlib_metadata
, and
importlib_resources
packages.Tested Review Board with loading and using extensions (integrations,
Review Bot, and Power Pack).