-
Notifications
You must be signed in to change notification settings - Fork 28
Create robust python modules #149
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: master
Are you sure you want to change the base?
Conversation
Covers installation and cleaning. Builds libgas.so as a dependency.
Includes renaming files to be underscored, and introducing a main function that is called at __name__ == "__main__"
The install step for l1d4-prep and l1d4-xt-viewer now create a .venv directory, and install the relevant packages within this. The scripts wrapped in proper binaries to execute in the correct .venv, and are symlinked to the INSTALL_DIR
In order to make proper .venv installs of executable tools, we need to be able to import from the original modules. Hyphens do not form a valid module name, and are replaced with underscores.
|
I've converted this to a draft while we experiment with the A couple of notes on what I've found while adding these updates
The updated This will hopefully cover the use-case on remote HPC machines with low/limited internet connectivity. If the user has installed python packages globally using If no virtual environment is active / manually specified, then the default action is to create a new virtual environment at Remaining Questions
|
Also removes the step of requiring the wheel to be built and installed from separately.
Modern Linux & Python distributions do not allow for packages to be globally installed, and modifying the
PYTHONPATHvariable is no longer recommended. This PR attempts to update the installation of our python tooling.Python Modules
Two main python modules are currently implemented:
gdtk(now contained in thegdtk-pydirectory)nenzf1dThe relevant
makefilerecipes now create wheels (see PEP 491), where are moved to$INSTALL_DIR/share/python-packages. A user can point their package manager to search this directory, for instancePIP_FIND_LINKS=$INSTALL_DIR/share/python-packages, orpip config set global.find-links $INSTALL_DIR/share/python-packagesThis allows the user to simply run
pip install gdtkin their project.Python Scripts
The commonly used python scripts (from what I can observe) have been converted to install within virtual environments (
.venvdirectories within theINSTALL_DIR), which allows isolated installs of the dependencies (e.g. numpy, scipy). The requirements for each set of scripts is detailed in apyproject.tomlfile (see spec), with a conservative minimum Python version of 3.8.The existing
makefiles now create the virtual environment and install the python "module" to it, and symlink the resulting binaries to$INSTALL_DIR/bin, as per their previous location.The end result for the user is unchanged.
Examples
A
pyproject.tomlis also created in the root ofexamples/, to ensure all relevant tools are installed for testing. Thepytestconfiguration forlmris moved to apytest.inifile, to avoid conflicts.Requirements
In order to work on HPC systems, this is designed to use backwards-compatible tools. With an internet connection, only
python3withpipis required.