LPC3D meeting (2024_10_29) - multixscale/meetings GitHub Wiki
Attending: Celine Merlet (Uni Toulouse), Hassane Harar (Uni Toulouse), Xin An (SURF), Caspar van Leeuwen (SURF)
-
How to show collaboration between technical and scientific WPs in LPC3D case?
- EESSI github CI action to create CI workflow
- What should that workflow do for LPC3D? E.g. run
--version
would be good enough. orpython -c "import lpc3d"
or whatever is appropriate. - We need 2 things before we can do this:
- LPC3D needs to be installable by pip before we can do this (i.e. need
pyproject.toml
) - LPC3D needs to take arguments (preferably using
argparse
) so that we can point to the input file
- LPC3D needs to be installable by pip before we can do this (i.e. need
- Build initial CI workflow (SURF), then handover to Toulouse
- What should that workflow do for LPC3D? E.g. run
- Deploy development build of the code in
dev.eessi.io
- Documentation on how to do that is here for now (SURF + Toulouse)
- Celine: Not our main priority right now, we really want to integrate with LAMMPS first
- Caspar: It could also help there, since it'll allow you to deploy development builds and test if that integration is working.
- Get LPC3D into EESSI
- Make an EasyConfig for it (SURF)
- Deploy into EESSI (SURF)
- Celine: we definitely want this
- Xin will look at creating an EasyConfig
- Requires the
pyproject.toml
andargparse
parts to be finished first - Not discussed in the meeting, but: we should also tag a 0.1.0 release in GitHub
- Requires the
- EESSI github CI action to create CI workflow
-
Currently missing in LPC3D
- Installation instructions: deps are listed, but how to install LPC3D itself is missing, probably because...
-
setup.py
orpyproject.toml
are missing (SURF + Toulouse)- See for example https://github.com/EESSI/test-suite/blob/main/pyproject.toml
- And the setuptools docs https://setuptools.pypa.io/en/latest/userguide/quickstart.html
- Initial PR made by Caspar, but needs proper values for metadata in
pyproject.toml
https://github.com/multixscale/LPC3D/pull/1 (review by Toulouse?) - TODO: refine the contents of that
pyproject.toml
(Toulouse)
- Argument parsing: how do I run a different example? Currently, I think I'd have to modify the LPC3D script
- You probably want to pass the input file as an argument, and do some argument parsing.
- Probably using
argparse
is a good idea, it's the standard in Python for argument parsing https://docs.python.org/3/library/argparse.html
- Probably using
- Would be good to add a
--help
argument to
- You probably want to pass the input file as an argument, and do some argument parsing.
- Manual says to run
OMP_NUM_THREADS=<something> python3 3D-lattice-gas.py
. I guess you renamed this toLPC3D.py
?
To make lpc3d
an executalbe is surprisingly simple:
In our pyproject.toml, we put
# Specify entry points for command-line usage
[project.scripts]
lpc3d = "LPC3D:main"
This declares that the LPC3D.py has a main function, and we want an executable with the name lpc3d to be installed to call it.
Then, our LPC3D.py should have a main function. An example of a minimal script that does have a main (and demonstrates the use of argparse
) is:
import argparse
def main():
# Initialize the argument parser
parser = argparse.ArgumentParser(description="A script that prints the provided argument.")
# Define a single positional argument
parser.add_argument("argument", help="The argument to be printed")
# Parse the arguments from the command line
args = parser.parse_args()
# Print the provided argument
print(f"Argument provided: {args.argument}")
# Run main if this script is executed directly
if __name__ == "__main__":
main()
Essentially, we can wrap the entire current LPC3D.py content in the def main():
definition and that should be it.
Also, regarding optional dependencies, they can be declared like so in the pyproject.toml
# General dependencies
dependencies = ["some-common-package"]
# Optional dependencies for specific components
[project.optional-dependencies]
component_a = ["dependency-for-a>=1.0", "another-dependency-for-a"]
Users can then install with:
pip install your-package-name
to get only the dependencies listed at 'dependency = ...', or with
pip install your-package-name[component_a]
to get the dependencies from 'dependency = ...' and the optional dependencies listed for component_a.
I.e. in your case I'd put in the pyproject.toml:
dependencies = ["pystencils", "numba", "ipython", "matplotlib", "pyevtk"]
# Optional dependencies for specific components
[project.optional-dependencies]
gpu = ["cupy-cuda"]
People can then install the CPU based version with:
pip install LPC3D
or the GPU version with:
pip install LPC3D[gpu]