indygreg / indygreg/PyOxidizer
Stacktrace on Windows using the mercurial_keyring extension
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 6.2k
- Forks
- 256
- PR merge metrics
- No merged PRs in 30d
Description
I triggered a cryptic ModuleNotFoundError stacktrace running hg incoming with pyoxidizer. I initially thought the command completely failed, but it was able to talk to the server, so it must have eventually loaded the credentials.
I'm not sure why this is happening, and I know keyring does some weird things that make hgdemandimport unhappy, but I thought I'd start with pyoxidizer, since it works fine with the vanilla py3 build of hg. I also hacked on pyoxidizer.bzl a bit to get it to build and run on macOS (mostly by taking the IS_WINDOWS conditional paths) , and it does not have this problem there, so I don't think there's something inherently wrong with the keyring package.
$ /c/Users/Matt/hg/build/pyoxidizer/x86_64-pc-windows-msvc/release/app/hg.exe in
Error initializing plugin EntryPoint(name='libsecret', value='keyring.backends.libsecret', group='keyring.backends').
Traceback (most recent call last):
File "keyring.backend", line 198, in _load_plugins
init_func = ep.load()
File "importlib.metadata", line 77, in load
module = import_module(match.group('module'))
File "importlib", 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 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'keyring.backends.libsecret'
Error initializing plugin EntryPoint(name='macOS', value='keyring.backends.macOS', group='keyring.backends').
Traceback (most recent call last):
File "keyring.backend", line 198, in _load_plugins
init_func = ep.load()
File "importlib.metadata", line 77, in load
module = import_module(match.group('module'))
File "importlib", 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 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'keyring.backends.macOS'
comparing with ...
$ /c/Users/Matt/hg/build/pyoxidizer/x86_64-pc-windows-msvc/release/app/hg.exe debugshell
(omit stacktrace here)
>>> import sys
>>> print(sys.path)
['c:\\Users\\Matt\\hg\\build\\pyoxidizer\\x86_64-pc-windows-msvc\\release\\app\\python39.zip', 'C:\\Users\\Matt\\hg\\build\\pyoxidizer\\x86_64-pc-windows-msvc\\release\\app\\DLLs', 'C:\\Users\\Matt\\hg\\build\
yoxidizer\\x86_64-pc-windows-msvc\\release\\app\\lib', 'c:\\Users\\Matt\\hg\\build\\pyoxidizer\\x86_64-pc-windows-msvc\\release\\app', 'C:\\Users\\Matt\\AppData\\Roaming\\Python\\Python39\\site-packages']
$ ls -l /c/Users/Matt/AppData/Roaming/Python/Python39/site-packages/keyring/backends/macOS/
total 7
-rw-r--r-- 1 Matt Administrators 1994 Sep 17 13:28 __init__.py
drwxr-xr-x 2 Matt Administrators 0 Sep 17 13:28 __pycache__
-rw-r--r-- 1 Matt Administrators 4357 Sep 17 13:28 api.py
$ py -m pip freeze | grep keyring
keyring==23.2.1
mercurial-keyring==1.4.1
hg 4e6f27230aee, pyoxidizer 0.16 and 0.17
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reported Windows build configuration in pyoxidizer.bzl, then reproduce hg incoming and inspect the debugshell sys.path and keyring backend imports. Compare the Windows behavior with the working vanilla Python and macOS cases; done means the Windows command no longer emits the reported ModuleNotFoundError stacktraces while handling credentials.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, rust
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100