Closed Bug 1970907 Opened 6 months ago Closed 5 months ago

Dependency pkg_resources is deprecated and due for removal by end of 2025

Categories

(Conduit :: moz-phab, defect)

Production
defect

Tracking

(Not tracked)

RESOLVED FIXED

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.

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.

Assignee: nobody → clauzilla
Status: NEW → ASSIGNED

@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!

Flags: needinfo?(sheehan)

(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 of r=’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!

Flags: needinfo?(sheehan)
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: