Dependency pkg_resources is deprecated and due for removal by end of 2025
Categories
(Conduit :: moz-phab, defect)
Tracking
(Not tracked)
People
(Reporter: clauzilla, Assigned: clauzilla)
Details
Attachments
(3 files)
Steps to reproduce:
Run moz-phab with setuptools v80.9.0 or newer installed.
Steps to reproduce:
cd "$(mktemp -d)"
python -m venv .venv
. .venv/bin/activate
pip install MozPhab setuptools
moz-phab --version
Actual results:
It prints the following warning:
/usr/lib/python3.13/site-packages/mozphab/sentry.py:13: UserWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html. The pkg_resources package is slated for removal as early as 2025-11-30. Refrain from using this package or pin to Setuptools<81.
from pkg_resources import get_distribution
Expected results:
No such warning should be visible.
The pkg_resources Python package, which is part of setuptools, has been deprecated since February 2023. In May 2025, upstream added code that prints a visible deprecation warning and imposed a deadline that they will remove the package in December 2025.
moz-phab should migrate away from pkg_resources to avoid breakage.
For the part of the pkg_resources API that moz-phab uses, equivalent alternatives exist, i.e. in the packaging third-party package, on which moz-phab already depends, and in the importlib.metadata package, which is part of the core API.
| Assignee | ||
Comment 1•6 months ago
|
||
The pkg_resources Python package, which is part of setuptools, has
been deprecated since February 2023 1. In May 2025, upstream added
code that prints a visible deprecation warning and imposed a deadline
that they will remove the package in December 2025. 2
Migrate to core APIs (importlib.metadata) and to an existing third-party
dependency (packaging) to remove all usages of the pkg_resources
package.
Updated•6 months ago
|
| Assignee | ||
Comment 2•6 months ago
|
||
@Connor Sheehan The moz-phab tool says my patch needs a reviewer.
I noticed you’ve been reviewing most patches lately, so I took the liberty of r=’ing you. Hope you don’t mind!
Comment 3•6 months ago
|
||
(In reply to Claudia Pellegrino from comment #2)
@Connor Sheehan The moz-phab tool says my patch needs a reviewer.
I noticed you’ve been reviewing most patches lately, so I took the liberty ofr=’ing you. Hope you don’t mind!
I don't mind at all. :)
I took a look at your patch, and had a small suggestion. Thanks for the patch!
Comment 4•5 months ago
|
||
Authored by https://github.com/claui
https://github.com/mozilla-conduit/review/commit/f9c72d4666b9cc392cc8c73b14e7840c127572f8
[main] Bug 1970907 - Migrate away from deprecated API r=sheehan
Comment 5•5 months ago
|
||
Accidentially not removed in D252875.
Comment 6•5 months ago
|
||
Authored by https://github.com/saschanaz
https://github.com/mozilla-conduit/review/commit/d274bb6c3f9803bea4fe67e2a9ceb8e6e92f36e2
[main] Bug 1970907 - Remove redundant importlib.metadata import r=sheehan
Description
•