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)

LPC3D

  • 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. or python -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
      • Build initial CI workflow (SURF), then handover to Toulouse
    • 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 and argparse parts to be finished first
        • Not discussed in the meeting, but: we should also tag a 0.1.0 release in GitHub
  • Currently missing in LPC3D

Follow-up email:

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]

⚠️ **GitHub.com Fallback** ⚠️