econ-ark / DistributionOfWealthMPC

The Distribution of Wealth and the Marginal Propensity to Consume
2 stars 8 forks source link

Reproduce via conda #14

Closed camriddell closed 1 year ago

camriddell commented 1 year ago

Previous PR #11 broke the reproduce.sh script as it still relied on a requirements.txt file to exist in the root of the repo. The reproduce.sh script will automatically create a conda environment for you that can execute the contents of this repo.

@alanlujan91 can you let me know what you think of this process is like for you? I'll probably need to flesh out the README.md instructions a little bit more but the general workflow will be.

Execute reproduce.sh

If you have conda installed, this will work right out of the box:

cd root/to/repo
sh ./reproduce.sh

Manual Reproductions

If you want to do anything outside of just running reproduce.sh you can:

cd root/of/repo
conda env update -f binder/environment.yml --prefix ./condaenv
conda activate ./condaenv

ipython do_min.py
...

The anaconda environment is stored in a folder called condaenv in the root of the repository. This folder has been added to .gitignore to prevent its contents from being uploaded to github.

To Remove the Environment

cd root/of/repo
conda env remove --prefix ./condaenv
camriddell commented 1 year ago

@alanlujan91 let me know if you have any questions, I'm iterating through a few options to balance a flexible- but still robustly reproducible process as possible.

alanlujan91 commented 1 year ago

I usually do the manual reproduction without the prefix. Is there an advantage to using the prefix / storing the environment within the repo?

camriddell commented 1 year ago

The only benefit is that it provides a tighter coupling between the environment and the reproduction. Meaning if you have 30 REMARKs on your local machine, you wouldn't need to cd into a repository and hope that you have an environment for it- you can already see if there is a condaenv folder present and activate it from there without a name intermediating.

That being said, I do imagine that most people work only by names so it would probably be beneficial to add a name to the environment that is the same as the repo as you suggested elsewhere.