Skip to content

menchelab/gathering_reproducibility

Repository files navigation

A repository for our gathering on reproducibility on the 2nd of December 2025

Instructions

  1. Install the uv python package manager
  2. Clone the repository
  3. Create a new branch locally
  4. Install the environment specified by environment.yml using uv
  5. Use uv to run try_to_run_me_after_env_install.py
  6. Try adding a new dependency to the project and also to the script
  7. Commit changes made to pyproject.toml and uv.lock file to your branch
  8. (Optional) Push your branch to this repository (only possible for menchelab members otherwise you can also try to fork and push to your own)

Bonus level

Once you managed to install the environment with uv you can try to create a container image containing the envrionment. To do so try the following

  1. Make sure you have Docker (or similar like Apptainer) installed
  2. Find suitable images of uv and a linux distribution of your choice on a registry like docker hub
  3. Use these images to generate a build script for a container (try following this or that guide to reduce the size of the resulting image)
  4. Run the container and try to execute try_to_run_me_after_env_install.py again

Happy reproducing :)

My solution

Environment conversion

The easiest way for me to do the following

git clone [email protected]:menchelab/gathering_reproducibility.git
cd gathering_reproducibility
uv init
# this is necessary to ensure correct python version
# because for me the default was the system wide which was not compatible with conda
uv python install 3.12
uv python pin 3.12
uv run try_to_run_me_after_env_install.py

On my mac it was also necessary to add the commented out settings to the pyproject.toml in order to get the correct torch wheel

Build a docker image

To build a docker image it is necessary get a linux distribution of your choice and then follow the instructions in the docs The Dockerfile contains the final build script that worked for me on my mac with Docker Desktop with some explanatory comments. After building it via the docker cli

cd gathering_reproducibility
docker build .

This builds an image that basically sets the global python to the one in the venv generated by uv which is akin to activate. On startup it fires up a bash shell so you can just run the image and then to python <your_script> to run anything with the packages in the venv. To run the container with the directory mounted you can use the following command

docker run -it -v <path_to_gathering_repo>:<absolute_path_to_directory_in_container> <image_hash>

After starting up you can then just navigate to <absolute_path_to_directory_in_container> and use python try_to_run_me_after_env_install.py to run the script. Here <path_to_gathering_repo> is the directory the repo resided on your computer and <absolute_path_to_directory_in_container> is the directory you want the repo to show up in your container session. e.g. I used the following -v ~/gathering_reproducibility:/workdir (path has to be absolute after the colon) which allowed me to do the following after startup

cd workdir
python try_to_run_me_after_env_install.py

Also please not that the image is quite large because the environment is also quite large. I tried to solve it with a multistage build but it did not result in a notable size reduction. Maybe there are more advanced techniques but I am too lazy to do more here :)

About

A repository for our gathering on reproducibility on the 2nd of December 2025

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published