Update djblets.extensions to drop usage of pkg_resources.
Review Request #13100 — Created June 6, 2023 and submitted
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).
Summary | ID |
---|---|
ba9da8c7ffb2159849263287abdf49d2f405d947 |
Description | From | Last Updated |
---|---|---|
Is this really something we want to do for 3.x? |
david | |
'typing.Dict' imported but unused Column: 1 Error code: F401 |
reviewbot | |
line too long (80 > 79 characters) Column: 80 Error code: E501 |
reviewbot | |
'importlib_resources' imported but unused Column: 1 Error code: F401 |
reviewbot | |
'pathlib.PosixPath' imported but unused Column: 1 Error code: F401 |
reviewbot | |
'importlib_resources' imported but unused Column: 1 Error code: F401 |
reviewbot |
- Change Summary:
-
- Removed unused imports.
- Added a missing typing import.
- Fixed a line length issue.
- Commits:
-
Summary ID 0388f464fcc073b21de7ce107bab1548a5563715 faa604c9b0b1c6adbb75598030594d5043e0a630