FS#69967 - [python-keyring] Missing dependency on python-importlib-metadata

Attached to Project: Community Packages
Opened by Moabit (Moabit) - Friday, 12 March 2021, 23:36 GMT
Last edited by Filipe Laíns (FFY00) - Saturday, 13 March 2021, 15:16 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Filipe Laíns (FFY00)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 4
Private No

Details

Description: python-keyring was updated, but now requires python-importlib-metadata. Without this it doesn't work.

Additional info:
* package version(s): 23.0.0-1

Steps to reproduce:
$ python -m keyring get foo bar
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 188, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.9/runpy.py", line 147, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.9/runpy.py", line 111, in _get_module_details
__import__(pkg_name)
File "/usr/lib/python3.9/site-packages/keyring/__init__.py", line 1, in <module>
from .core import (
File "/usr/lib/python3.9/site-packages/keyring/core.py", line 11, in <module>
from . import backend, credentials
File "/usr/lib/python3.9/site-packages/keyring/backend.py", line 12, in <module>
import importlib_metadata as metadata
ModuleNotFoundError: No module named 'importlib_metadata'

Installing python-importlib-metadata fixes this problem
This task depends upon

Closed by  Filipe Laíns (FFY00)
Saturday, 13 March 2021, 15:16 GMT
Reason for closing:  Fixed
Additional comments about closing:  python-keyring 23.0.0-2
Comment by Chris Billington (chrisjbillington) - Saturday, 13 March 2021, 01:21 GMT
It's worse now - since 23.0.0-1, python-keyring now requires importlib-metadata 3.6, but the latest in the repos is 3.4. I'm unsure whether there is an actual consequence to using an out-of-date importlib-metadata, but in some contexts consistency is required and you get an error if dependencies aren't satisfied.

As a result, twine isn't working at the moment because keyring's dependency is not the required version:

$ twine
Traceback (most recent call last):
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 568, in _build_master
ws.require(__requires__)
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 886, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 777, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (importlib-metadata 3.4.0 (/usr/lib/python3.9/site-packages), Requirement.parse('importlib_metadata>=3.6'), {'keyring'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/bin/twine", line 33, in <module>
sys.exit(load_entry_point('twine==3.3.0', 'console_scripts', 'twine')())
File "/usr/bin/twine", line 25, in importlib_load_entry_point
return next(matches).load()
File "/usr/lib/python3.9/importlib/metadata.py", line 77, in load
module = import_module(match.group('module'))
File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "/usr/lib/python3.9/site-packages/twine/__main__.py", line 22, in <module>
from twine import cli
File "/usr/lib/python3.9/site-packages/twine/cli.py", line 17, in <module>
import pkg_resources
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3243, in <module>
def _initialize_master_working_set():
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3226, in _call_aside
f(*args, **kwargs)
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 3255, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 570, in _build_master
return cls._build_from_requirements(__requires__)
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 583, in _build_from_requirements
dists = ws.resolve(reqs, Environment())
File "/usr/lib/python3.9/site-packages/pkg_resources/__init__.py", line 772, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'importlib_metadata>=3.6' distribution was not found and is required by keyring
Comment by Chris Billington (chrisjbillington) - Saturday, 13 March 2021, 03:07 GMT
If you change the check() function to:

python setup.py pytest --allow-hosts ','

Then pytest will error instead of just downloading the required dependencies from pyPI if some are missing or are not the required version.

Otherwise check() is kind of pointless for checking that versions and dependencies are satisfied - it fixes any problems it finds automatically, solely for the purposes of running tests, instead of reporting them as problems!
Comment by Oleksandr Natalenko (post-factum) - Saturday, 13 March 2021, 12:09 GMT Comment by Chris Billington (chrisjbillington) - Saturday, 13 March 2021, 12:27 GMT
Kinda. But until keyring migrates to use the stdlib module, it still has the external dependency. If they release a version that doesn't depend on importlib_metadata, then that would also fix this issue!
Comment by loqs (loqs) - Saturday, 13 March 2021, 15:03 GMT
If you update python-importlib-metadata to 3.7.2 using the attached PKGBUILD (note check fails) does that satisfy the requirements?

Loading...