txusser / simpet

SimPET is a framework intended to setup and launch PET imaging Monte Carlo simulations on a simple way. It uses popular tools such as SimSET and STIR
9 stars 9 forks source link

Refactoring `setup.py` in a makefile, adding docker functionality and tracking stuff with Git LFS and `git submodules` #12

Closed YerePhy closed 1 year ago

YerePhy commented 1 year ago

What?

  1. Change in the installation process.
  2. Adition of docker functionality.
  3. Tracking STIR as submodule.
  4. Tracking installation files with Git LFS.
  5. Update of requirements.txt.
  6. Refactoring of the GitHub Workflow.

    Why?

  7. Uncuple the installation process and reduce the number of lines, have a file just dedicated to that where the system dependencies are well defined.
  8. Portability, easier usage of SIMPET, ready-to-use SIMPET (pulling the image from dockerhub), users or developers may not want to install all the system dependencies in their machines, etc.
  9. I see this as prophylaxis, it might not offer a significant advantage over git clone but it makes installation easier.
  10. Tracking those files are more secure (no SSH connections with hardcoded passwords and ports) and makes easier the installation of system dependencies.
  11. There was a new necessary dependency.
  12. It was buggy and it needed to incorporate the new installation procedure and set up the correct environment in order to run the test simulation.

    How?

  13. Through a makefile (used only for installation, checks and cleans) and keeping setup.py as test.py only for test simulation.
  14. Adding a Dockerfile, a docker-compose.yaml and a .dockerignore (pretty standard stuff).
  15. Adding STIR as a new project's git submodule with git submodule add and a .gitmodules file.
  16. Just using Git LFS commands.
  17. Does not need an explanation.
  18. Installling system dependencies with make install (step Build), installing python 3.9 (step python3.9 Installation), setting LD_LIBRARY_PATH, adding format_converters to $PATH with $GITHUB_PATH and manually changing the paths in config.yaml with yq and ${{ github.workspace }}.

    Testing?

    Passing the GitHub Action (installs dependencies and runs a test simulation).

    Anything Else?

    In order to use the docker image:

  19. Pull it from dockerhub: docker pull yerephy/simpet:0:1:0.
  20. Launch the service from root folder project with: docker-compose up -d.
  21. Run a bash shell insider the container: docker exec -it simpet bash.
  22. Set up git filters inside the container: cd $HOME/simpet && make config-git.
  23. Checkout the config file in order to apply smudge filter and set config.yaml automatically: rm config.yaml && git checkout config.yaml.
  24. Uncompress the test image: make dummy-data.
  25. Run test simulation: python3.9 test.py.