-
Notifications
You must be signed in to change notification settings - Fork 0
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
Being more explicit with the import of importlib.util. #181
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #181 +/- ##
==========================================
+ Coverage 38.93% 38.99% +0.06%
==========================================
Files 23 23
Lines 1983 1985 +2
==========================================
+ Hits 772 774 +2
Misses 1211 1211 ☔ View full report in Codecov by Sentry. |
@@ -155,7 +156,7 @@ def _find_external_library_default_config_paths(runtime_config: dict) -> set: | |||
else: | |||
if key == "name" and "." in value: | |||
external_library = value.split(".")[0] | |||
if importlib.util.find_spec(external_library) is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK that is really weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if some package deep in fibad or KBMOD's dep tree is conditionally replacing functions in importlib.util?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we start python on the command line and run the following on baldur in an environment that shares a kbmod installation
>>> import importlib
>>> importlib.ut <attempt tab complete, nothing happens>
>>> importlib.util
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'importlib' has no attribute 'util'
It does seem unpleasant, but it seems to work.
Outside of a KBMOD environment, there's no problem with:
>>> import importlib
>>> importlib.util
* Being more explicit with the import of importlib.util. * Importing importlib.util in the one other place it is used.
This seems to address the issue that was raised in issue #108. Still not immediately clear why this is sometimes an issue, but it seems to be.