Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyring 22.4.0+ fails to be imported in Python 3.8+ #499

Closed
ccordoba12 opened this issue Mar 6, 2021 · 3 comments
Closed

Keyring 22.4.0+ fails to be imported in Python 3.8+ #499

ccordoba12 opened this issue Mar 6, 2021 · 3 comments
Labels

Comments

@ccordoba12
Copy link

ccordoba12 commented Mar 6, 2021

Describe the bug

Keyring fails to be imported in Python 3.8+ due to this import:

import importlib_metadata as metadata

Since that functionality is part of the standard library in Python 3.8+, it needs to written as

import importlib.metadata as metadata

for those versions (I understand the import is correct for older ones).

To Reproduce
Steps to reproduce the behavior:

  1. Install Keyring 22.4.0 or later in Python 3.8+
  2. Open a Python interpreter
  3. import keyring

Expected behavior
Keyring shouldn't fail when imported.

Environment

@Zac-HD
Copy link

Zac-HD commented Mar 7, 2021

Came here with a similar report; the trick is to make the dependency conditional on Python version and then to try importing the stdlib version before falling back to the backport on ImportError. https://github.com/HypothesisWorks/hypothesis/search?q=importlib_metadata shows how we do that in Hypothesis (which indirectly depends on keyring - so thanks 🥰)

@Zac-HD
Copy link

Zac-HD commented Mar 14, 2021

Based on the failing CI for #502, I think we're just asking for 473465e to be reverted... it's a nicer interface for the implementation of keyring, but as a consumer of the code I'd prefer to avoid the extra dependency 😕

@jaraco
Copy link
Owner

jaraco commented Mar 14, 2021

As reported, this issue is invalid. As can be clearly seen in 473465e, Keyring intentionally added the dependency for additional Python versions to adopt new features in importlib_metadata 3.6. The recommendation is to install the package with its declared dependencies and everything should work as designed.

Please let me know if I can advise conda on how to support this change.

@jaraco jaraco closed this as completed Mar 14, 2021
not-chicken added a commit to not-chicken/void-packages that referenced this issue May 19, 2021
This package was dropped earlier as its functionality was
added into Python 3.8 standard library.
However, this package contains features that are not (yet) part
of Python's standard library. Those features are needed by
python3-keyring package. So, re-introduce this package.

See: jaraco/keyring#499 (comment)
not-chicken added a commit to not-chicken/void-packages that referenced this issue Jun 8, 2021
This package was dropped earlier as its functionality was
added into Python 3.8 standard library.
However, this package contains features that are not (yet) part
of Python's standard library. Those features are needed by
python3-keyring package. So, re-introduce this package.

See: jaraco/keyring#499 (comment)
not-chicken added a commit to not-chicken/void-packages that referenced this issue Jun 13, 2021
This package was dropped earlier as its functionality was
added into Python 3.8 standard library.
However, this package contains features that are not (yet) part
of Python's standard library. Those features are needed by
python3-keyring package. So, reintroduce this package.

See: jaraco/keyring#499 (comment)
ericonr pushed a commit to void-linux/void-packages that referenced this issue Jun 15, 2021
This package was dropped earlier as its functionality was
added into Python 3.8 standard library.
However, this package contains features that are not (yet) part
of Python's standard library. Those features are needed by
python3-keyring package. So, reintroduce this package.

See: jaraco/keyring#499 (comment)
hazayan pushed a commit to hazayan/void-packages that referenced this issue Jun 25, 2021
This package was dropped earlier as its functionality was
added into Python 3.8 standard library.
However, this package contains features that are not (yet) part
of Python's standard library. Those features are needed by
python3-keyring package. So, reintroduce this package.

See: jaraco/keyring#499 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants