This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Move from pkg_resources
to importlib.resources
#12508
Labels
T-Task
Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
Comments
DMRobertson
added
good first issue
Good for newcomers
T-Task
Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
P4
(OBSOLETE: use S- labels.) Okay backlog: will not schedule, will accept patches
labels
Apr 20, 2022
4 tasks
Having tried this out (many thanks @vheuken), it wasn't an easy 1-1 replacement. The sticking point is that we pass template directories to Jinja2, falling back to a default template directory distributed as a package resource. synapse/synapse/config/_base.py Lines 273 to 282 in 4586119
But importlib.resources makes it tricky to get hold of that path. (It's concerned with providing access to specific file-like resources, which may not correspond to a filesystem directory). #12542 (comment) has more details. I think it's best to drop this for now. |
DMRobertson
removed
good first issue
Good for newcomers
P4
(OBSOLETE: use S- labels.) Okay backlog: will not schedule, will accept patches
labels
Apr 27, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
T-Task
Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
The documentation for
pkg_resources
declares the package to be deprecated:It would be nice (though by no means critically important) to follow this advice. The standalone backport module
importlib_resources
provides a migration guide.Grepping the source tree for
pkg_resources
, we currently use:The first two are covered by the migration guide. The third can be replaced by
packaging.version.Version
. We already depend on packaging >= 16.1, and AFAICS from its changelog the Version type and its functionality we use have been present sincepackaging
's initial release.Once this and #12478 is done, we can remove the development dependency on
types-setuptools
.Task list:
poetry lock --no-update
)The text was updated successfully, but these errors were encountered: