Skip to content

Commit

Permalink
Merge pull request #154 from camriddell/remark-cli
Browse files Browse the repository at this point in the history
REMARK cli.py
  • Loading branch information
alanlujan91 committed Apr 3, 2024
2 parents 089dae2 + 70839b0 commit 717319b
Show file tree
Hide file tree
Showing 30 changed files with 528 additions and 39 deletions.
89 changes: 89 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,92 @@ Jupyter notebook(s) should:
## Differences with DemARK

The key difference with the contents of the [DemARK](https://github.com/econ-ark/DemARK) repo is that REMARKs are allowed to rely on the existence of local files and subdirectories (figures; data) at a predictable filepath relative to the location of the root.

## For Maintainers

**Command Line Interface** `cli.py`

`cli.py` is an automated tool that facilitates:
- cloning of REMARK repositories
- linting (detection of missing files from a given REMARK)
- building conda environments/docker images
- uses `conda`/`repo2docker` under the hood
- executing `reproduce.sh` scripts within the built environments.

All artifacts generated by `cli.py` are stored in a newly created `_REMARK` folder.

1. Once you clone a REMARK you'll be able to find its contents inside of `_REMARK/repos/…`
2. Once you build/execute a REMARK you'll be able to find a corresponding log
file from that process inside of `_REMARK/logs/…`

`cli.py` has built-in parallelization specified by the `-J` flag for many actions.

### Requirements

- python 3.9 or newer.
- contents `requirements.txt`

### Action

**Clone/Pull**

pulling REMARKs (these are populated in the `_REMARKS` folder)

```bash
python cli.py pull --all # git clone all REMARKS
python cli.py pull {remark_name} # git clone one or more REMARK(s)
```

**Lint**

Shows what files are missing from given REMARK(s). The linter uses the
file-tree print out from STANDARD.md and compares it to the current files found
in the currently cloned REMARK(s).

```bash
python cli.py lint --all # detect missing files from all REMARKs
python cli.py lint {remark_name} # detect missing files from one or more REMARK(s)
```

**Build**

Building conda environments and/or docker images.

```bash
python cli.py build conda --all # build conda environments for all REMARKs (stored as a `condaenv` folder inside the cloned REMARK repo)
python cli.py build docker --all # build docker images for all REMARKs (stored as a `condaenv` folder inside the cloned REMARK repo)
python cli.py build conda {remark_name} # build conda environments for one or more REMARK(s)
python cli.py build docker {remark_name} # build docker image(s) for one or more REMARK(s)
```

The primary difference between `conda` and `docker` for builds are that `docker` will be more flexible for multilanguage REMARKs. It leverages
repo2docker (same tool that mybinder uses) to create docker images from repositories.

**Execute**

Automated execution within built conda environments/docker containers.

```bash
python cli.py execute conda --all # execute reproduce.sh via conda for all REMARKs
python cli.py execute docker --all # execute reproduce.sh via docker for all REMARKs
python cli.py execute conda {remark_name} # execute reproduce.sh via conda for one or more REMARK(s)
python cli.py execute docker {remark_name} # execute reproduce.sh via docker for one or more REMARK(s)
```

*Both the build and execute subcommands have an optional --jobs argument to
specify the number of jobs to run in parallel when building/executing.*

**Logs/Summarize**

```bash
python cli.py logs # view most recent logs for all previous building/executing commands
```

**Clean/Remove**

```bash
python cli.py clean conda --all # remove all built conda environments
python cli.py clean docker --all # remove all build docker images
python cli.py clean conda {remark_name} # remove conda environment(s) from specified REMARK(s)
python cli.py clean docker {remark_name} # remove docker images built from specified REMARK(s)
```
3 changes: 3 additions & 0 deletions REMARKs/Aiyagari-Idiosyncratic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: Aiyagari-Idiosyncratic
remote: https://github.com/econ-ark/Aiyagari-Idiosyncratic
title: Uninsured Idiosyncratic Risk and Aggregate Saving
4 changes: 4 additions & 0 deletions REMARKs/BayerLuetticke.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: BayerLuetticke
remote: https://github.com/econ-ark/BayerLuetticke
title: Solving heterogeneous agent models in discrete time with many idiosyncratic
states by perturbation methods
9 changes: 0 additions & 9 deletions REMARKs/BlanchardPA2019.bib

This file was deleted.

3 changes: 3 additions & 0 deletions REMARKs/BlanchardPA2019.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: BlanchardPA2019
remote: https://github.com/econ-ark/BlanchardPA2019
title: Public Debt and Low Interest Rates
3 changes: 3 additions & 0 deletions REMARKs/BufferStock-LifeCycle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: BufferStock-LifeCycle
remote: https://github.com/econ-ark/BufferStock-LifeCycle
title: Buffer-Stock Saving and the Life Cycle/Permanent Income Hypothesis
11 changes: 0 additions & 11 deletions REMARKs/BufferStockTheory.bib

This file was deleted.

3 changes: 3 additions & 0 deletions REMARKs/BufferStockTheory.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: BufferStockTheory
remote: https://github.com/econ-ark/BufferStockTheory
title: BufferStockTheory
3 changes: 3 additions & 0 deletions REMARKs/CGMPortfolio.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: CGMPortfolio
remote: https://github.com/econ-ark/CGMPortfolio
title: 'REMARK: Consumption and Portfolio Choice Over the Life Cycle'
3 changes: 3 additions & 0 deletions REMARKs/DistributionofWealthMPC.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: DistributionofWealthMPC
remote: https://github.com/econ-ark/DistributionOfWealthMPC
title: The distribution of wealth and the marginal propensity to consume
3 changes: 3 additions & 0 deletions REMARKs/DurableConsumerType.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: DurableConsumerType
remote: https://github.com/econ-ark/DurableConsumerType_REMARK
title: A Guide on Solving Non-convex Consumption-Saving Models
3 changes: 3 additions & 0 deletions REMARKs/EndogeneousRetirement.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: EndogeneousRetirement
remote: https://github.com/econ-ark/EndogenousRetirement
title: 'Endogenous Retirement: A Canonical Discrete-Continuous Problem'
3 changes: 3 additions & 0 deletions REMARKs/EpiExp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: EpiExp
remote: https://github.com/econ-ark/EpiExp
title: Epidemiological Expectations in Economics
3 changes: 3 additions & 0 deletions REMARKs/GanongNoelUI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: GanongNoelUI
remote: https://github.com/econ-ark/GanongNoelUI
title: 'Consumer Spending during Unemployment: Positive and Normative Implications'
10 changes: 0 additions & 10 deletions REMARKs/KrusellSmith.bib

This file was deleted.

3 changes: 3 additions & 0 deletions REMARKs/KrusellSmith.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: KrusellSmith
remote: https://github.com/econ-ark/KrusellSmith
title: Income and Wealth Heterogeneity in the Macroeconomy
3 changes: 3 additions & 0 deletions REMARKs/LiqConstr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: LiqConstr
remote: https://github.com/econ-ark/LiqConstr
title: Liquidity Constraints and Precautionary Saving
2 changes: 2 additions & 0 deletions REMARKs/Pandemic.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ keywords: # optional

# Pandemic-Consumption-Response

[![badge](https://img.shields.io/badge/Launch-Dashboard-579ACA.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFkAAABZCAMAAABi1XidAAAB8lBMVEX///9XmsrmZYH1olJXmsr1olJXmsrmZYH1olJXmsr1olJXmsrmZYH1olL1olJXmsr1olJXmsrmZYH1olL1olJXmsrmZYH1olJXmsr1olL1olJXmsrmZYH1olL1olJXmsrmZYH1olL1olL0nFf1olJXmsrmZYH1olJXmsq8dZb1olJXmsrmZYH1olJXmspXmspXmsr1olL1olJXmsrmZYH1olJXmsr1olL1olJXmsrmZYH1olL1olLeaIVXmsrmZYH1olL1olL1olJXmsrmZYH1olLna31Xmsr1olJXmsr1olJXmsrmZYH1olLqoVr1olJXmsr1olJXmsrmZYH1olL1olKkfaPobXvviGabgadXmsqThKuofKHmZ4Dobnr1olJXmsr1olJXmspXmsr1olJXmsrfZ4TuhWn1olL1olJXmsqBi7X1olJXmspZmslbmMhbmsdemsVfl8ZgmsNim8Jpk8F0m7R4m7F5nLB6jbh7jbiDirOEibOGnKaMhq+PnaCVg6qWg6qegKaff6WhnpKofKGtnomxeZy3noG6dZi+n3vCcpPDcpPGn3bLb4/Mb47UbIrVa4rYoGjdaIbeaIXhoWHmZYHobXvpcHjqdHXreHLroVrsfG/uhGnuh2bwj2H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y+XVKdjFCTh+zGaVuj0d9zy05PPK3QzBamxdwtTCrzyg/2Rvf2EstUjordGwa/kx9mSJLr8mLLtCW8HHGJc2R5hS219IiF6PnTusOqcMl57gm0Z8kanKMAQg0qSyuZfn7zItsbGyO9QlnxY0eCuD1XL2ys/MsrQhltE7Ug0uFOzufJFE2PxBo/YAx8XPPdDwWN0MrDRYIZF0mSMKCNHgaIVFoBbNoLJ7tEQDKxGF0kcLQimojCZopv0OkNOyWCCg9XMVAi7ARJzQdM2QUh0gmBozjc3Skg6dSBRqDGYSUOu66Zg+I2fNZs/M3/f/Grl/XnyF1Gw3VKCez0PN5IUfFLqvgUN4C0qNqYs5YhPL+aVZYDE4IpUk57oSFnJm4FyCqqOE0jhY2SMyLFoo56zyo6becOS5UVDdj7Vih0zp+tcMhwRpBeLyqtIjlJKAIZSbI8SGSF3k0pA3mR5tHuwPFoa7N7reoq2bqCsAk1HqCu5uvI1n6JuRXI+S1Mco54YmYTwcn6Aeic+kssXi8XpXC4V3t7/ADuTNKaQJdScAAAAAElFTkSuQmCC)](https://xhrtcvh6l53u.curvenote.dev/services/binder/v2/gh/econ-ark/Pandemic/HEAD?urlpath=/voila/render/Code/Python/dashboard.ipynb)

This repository is a complete software archive for the paper "Modeling the Consumption Response to the CARES Act" by Carroll, Crawley, Slacalek, and White (2020). This README file provides instructions for running our code on your own computer, as well as adjusting the parameters of the model to produce alternate versions of the figures in the paper.

## References
Expand Down
3 changes: 3 additions & 0 deletions REMARKs/Pandemic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: Pandemic
remote: https://github.com/econ-ark/Pandemic
title: Modeling the Consumption Response to the CARES Act
3 changes: 3 additions & 0 deletions REMARKs/PortfolioChoiceBlogPost.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: PortfolioChoiceBlogPost
remote: https://github.com/econ-ark/PortfolioChoiceBlogPost
title: Optimal Financial Investment over the Life Cycle - Blog Post
3 changes: 3 additions & 0 deletions REMARKs/RiskyContrib.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: RiskyContrib
remote: https://github.com/econ-ark/RiskyContrib
title: A Two-Asset Savings Model with an Income-Contribution Scheme
3 changes: 3 additions & 0 deletions REMARKs/Sequential Endogenous Grid Method.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: Sequential Endogenous Grid Method
remote: https://github.com/alanlujan91/SequentialEGM
title: 'EGM^n: The Sequential Endogenous Grid Method'
2 changes: 1 addition & 1 deletion REMARKs/SolvingMicroDSOPs.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ keywords: # optional

# Solution Methods for Microeconomic Dynamic Stochastic Optimization Problems

These notes describe tools for solving microeconomic dynamic stochastic optimization problems, and show how to use those tools for efficiently estimating a standard life cycle consumption/saving model using microeconomic data. No attempt is made at a systematic overview of the many possible technical choices; instead, I present a specific set of methods that have proven useful in my own work (and explain why other popular methods, such as value function iteration, are a bad idea). Paired with these notes is Mathematica, Matlab, and Python software that solves the problems described in the text.
These notes describe tools for solving microeconomic dynamic stochastic optimization problems, and show how to use those tools for efficiently estimating a standard life cycle consumption/saving model using microeconomic data. No attempt is made at a systematic overview of the many possible technical choices; instead, I present a specific set of methods that have proven useful in my own work (and explain why other popular methods, such as value function iteration, are a bad idea). Paired with these notes is Mathematica, Matlab, and Python software that solves the problems described in the text.
3 changes: 3 additions & 0 deletions REMARKs/SolvingMicroDSOPs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: SolvingMicroDSOPs
remote: https://github.com/econ-ark/SolvingMicroDSOPs
title: Solution Methods for Microeconomic Dynamic Stochastic Optimization Problems
3 changes: 3 additions & 0 deletions REMARKs/beyond-the-streetlight.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: beyond-the-streetlight
remote: https://github.com/dedwar65/beyond-the-streetlight
title: Beyond the streetlight
3 changes: 3 additions & 0 deletions REMARKs/cAndCwithStickyE.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: cAndCwithStickyE
remote: https://github.com/econ-ark/cAndCwithStickyE
title: Sticky Expectations and Consumption Dynamics
3 changes: 3 additions & 0 deletions REMARKs/ctDiscrete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: ctDiscrete
remote: https://github.com/econ-ark/ctDiscrete
title: A Tractable Model of Buffer Stock Saving
21 changes: 13 additions & 8 deletions STANDARD.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,26 @@ The PR should add a link to the repository to the Catalog (currently, in the REA

## The REMARK Standard

```
.
|-- reproduce.sh
|-- CITATION.cff
`-- binder
`-- environment.yml
```

The REMARK's repository must:
1. Have a [tagged release](https://docs.github.com/en/github/administering-a-repository/managing-releases-in-a-repository), the last commit before including it as a REMARK should be tagged with a 1.0 release.
2. In that repository at that release, there must be:
- In either the top-level directory or a `binder/` directory, either:
- installation files for `pip`:
- a `runtime.txt` containing the name of a python version, e.g. `python-3.9.0`
- a `requirements.txt` file with pinned dependencies (such as created by the command `pip freeze > requirements.txt`), or...
- installation files for conda:
- There must be a `binder/` directory containing an `environment.yml`:
- an `environment.yml` file with pinned dependencies
- A `reproduce.sh` script that
- Installs the requirements
- Runs and reproduces all the results
3. Include a valid CITATION.cff document with bibliographic
metadata for the repository.

3. Include a valid CITATION.cff document with bibliographic metadata for the repository.
4. Subset of results that you are claiming to be reproducible.
- This could be specified as a directory?

It is **strongly recommended** to include:
- If reproduce.sh takes longer than a few minutes, a `reproduce_min.sh` that generates some interesting subset of results within a few minutes
- A Jupyter notebook that exposits the material being reproduced.
Expand Down
Loading

0 comments on commit 717319b

Please sign in to comment.