-
Notifications
You must be signed in to change notification settings - Fork 212
Fix to allow pip install -e .
to work seamlessly with newer pip/setuptools versions
#4884
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
base: develop
Are you sure you want to change the base?
Conversation
pip install -e .
to work seamlessly with newer pip/setuptools versionspip install -e .
to work seamlessly with newer pip/setuptools versions
try: | ||
mod = importlib.import_module(namespace) | ||
except ImportError as err: | ||
raise EasyBuildError("import_available_modules: Failed to import %s: %s", namespace, err) |
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 changes the semantics of import_available_modules
, since no hard error was being raised before when the specified namespace didn't exist?
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.
For what i can see import_available_modules
is always used to import all sub-modules of a specific namespace similar to doing a from NAMESPACE import *
.
In particular for #4451 the failure would be obfuscated as something EB requires missing
I did not see a use in framework where this is expected to fail the import with it not being a problem.
If we really wanted to preserve the original behavior we could add a strict
parameter to the call that default to False
and set it to true everywhere this is used
On a sidenote we could also modernize the fetching of the submodules using pkg_util.iter_modules following an approach similar to https://www.tutorialspoint.com/how-do-i-import-all-the-submodules-of-a-python-namespace-package EGImporting installed package
Importing from current dir
With python 3.6 in a docker containerRan
@boegel What do you think? Happy to add it in this or another PR (rewriting the 1-line version to be clearer) |
Fixes
eb
command fails outside of framework source folder #4451The idea here is instead of relying on
sys.path
which might not include everything python knows how to import, we rely on python's import functions to determine if a module is importable or not and than pick the path from the imported module