-
Notifications
You must be signed in to change notification settings - Fork 79
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
Replace uses of deprecated imp with importlib #307
Conversation
Codecov Report
@@ Coverage Diff @@
## main #307 +/- ##
==========================================
- Coverage 52.02% 51.95% -0.08%
==========================================
Files 37 37
Lines 8451 8463 +12
Branches 1810 1811 +1
==========================================
Hits 4397 4397
- Misses 3737 3749 +12
Partials 317 317
Flags with carried forward coverage won't be shown. Click here to find out more.
|
c21d73e
to
7b49e85
Compare
stone/cli.py
Outdated
def _load_module(name, path): | ||
file_name = os.path.basename(path) | ||
module_name = file_name.replace('.', '_') | ||
|
||
module_specs = importlib.util.spec_from_file_location(module_name, path) | ||
module = importlib.util.module_from_spec(module_specs) | ||
module_specs.loader.exec_module(module) | ||
|
||
sys.modules[name] = module | ||
|
||
return module | ||
|
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.
This doesn't work for python <= 3.5, if you want to preserve the ability to run those lower versions, you can borrow inspiration from https://github.com/epfl-scitas/spack/blob/a60ae07083a5744607064221a0cd48204a54394e/lib/spack/llnl/util/lang.py#L598-L625
Fixes #295 |
* Fix ci: pin linux, pin flake8, ignore type error, fix mypy (#308) * Replace uses of deprecated imp with importlib (#307) * Update cli.py to work with java sdk (#310) --------- Co-authored-by: Jay <[email protected]>
Imp is removed in Python3.12, we should use importlib instead. This will also quiet some deprecation warnings.
Checklist
General Contributing
Is This a Code Change?
Validation
tox
?