PBR

PBR should not rely on pkg_resources anymore

Bug #1822332 reported by Gaetan Semet
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PBR
New
Undecided
Unassigned

Bug Description

Hello.
pkg_resources library is no more recommended to be used, or at least we could expect an end of life pretty soon.

Its replacement is importlib-resource which is an optional component to install with pip for Python <3.7 and became part of the default distribution for 3.7+.

A Migration guide is provided to get rid of support of pkg_resources [1].

PBR should begging supporting using importlib-resource, at first as a backup in case pkg_resource is not packaged correctly (ex: I have this error in a pynsist package):

  ...
    from jira import JIRA
  File "...pkgs\jira\__init__.py", line 6, in <module>
    _v = VersionInfo('jira').semantic_version()
  File "...pkgs\pbr\version.py", line 462, in semantic_version
    self._semantic = self._get_version_from_pkg_resources()
  File "...\pkgs\pbr\version.py", line 439, in _get_version_from_pkg_resources
    import pkg_resources
  ModuleNotFoundError: No module named 'pkg_resources'

Here my proposal:
- keep pkg_resource the default
- if the previous exception occurs, try with importlib.resource

[1] https://importlib-resources.readthedocs.io/en/latest/migration.html#migration

Revision history for this message
Marcel Telka (marcel-telka) wrote :

Is there any plan to drop dependency on pkg_resources soon?

Thank you.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.