The RMI Python Project Template

Getting Started

See setting up your development environment for general tool installation and configuration.

Setup patio environment

Unfortunately, geopandas doesn’t work properly when installed using uv (or pip) so we use patio with pixi.

brew install pixi

Navigate to the cloned patio repository and run the following to setup patio with pixi. Note: do not clone patio to anywhere managed by OneDrive.

pre-commit install
pixi install

If you have not yet initialized etoolbox on your computer, run this command and follow the instructions:

pixi run etb cloud init

The FRED_API_KEY and BLS_KEY must be set as environment variables. To set the environment variable FRED_API_KEY with the value abcd1234 (replace this value with your actual API key), use the following command:

echo 'export FRED_API_KEY=abcd1234' >> ~/.zshenv

The value can be retrieved in R using its key:

FRED_API_KEY <- Sys.getenv("FRED_API_KEY")

Additional information on setting up your IDE to use the pixi environment see these guides PyCharm, RStudio.

Working with the econ model

For the R code to work properly, additional setup is required if you do not have conda installed. You can test this by running conda in your terminal, if it says something like command not found: conda, then it needs to be installed.

Install conda

Install conda with pixi:

pixi global install conda

Initialize conda.

~/.pixi/bin/conda init $(basename $SHELL)

Using R tools

For RStudio to use the patio environment created in the previous steps, you must open it from the terminal with the following command. The first time running this may take a long time as additional R packages are downloaded and compiled.

pixi run rstudio

Launch the R console.

pixi run R

Additional comments on using Pre-commit

Most git GUI tools work with pre-commit but don’t work that well. The terminal based git is usually the safer choice. See notes on git for for recommendations and instructions.

Running the clean repowering model model

To run the resource model:

pixi run patio

To run the economic model with <model-run-datestr> replaced with the run’s name/identifier:

pixi run patio-econ <model-run-datestr>