Description
Is your feature request related to a problem? Please describe.
Currently the programming language (python, R) wrapper scripts are awkward to run, and often require eval
ing the wrapper script, which is often considered bad or dangerous so users may not feel comfortable doing this. This is also confusingly very different to the native "load a library" syntax that most languages have. In addition, loading them often requires a knowledge of the precise location of the wrapper script on the filesystem. For example, on my HPC system we have modules installed at /usr/local/modules/5.2.0
which differs from the documentation which tells us to use /usr/share/Modules
. I will use Python as a motivating example. In the docs we are told to do this to enable modules
in Python:
import os
exec(open('/usr/share/Modules/init/python.py').read())
As noted, this won't even actually work with my modules installation path.
Describe the solution you'd like
A nice solution would be to compile actual native language packages as part of the build process. For example, this would be possible in Python if we built a Python package that contained roughly the function function output by modulecmd python autoinit
, and published it into a given (configurable) Python path, and then exported PYTHONPATH=/path/to/module/script:$PYTHONPATH
so that Python can find it.
With this done, a user could simply import modules
or perhaps import env_modules
to distinguish this package from Python's own modules system. This would avoid the issues mentioned above. Similar arguments apply to R and other languages that I understand less well.
Describe alternatives you've considered
The current system of eval
ing specific files does work, but has disadvantages as described above.