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.

pre-commit install
pixi install

If the pixi command is not recognized after restarting the terminal you may need to add it to your path.

echo 'export PATH=~/.pixi/bin:$PATH'  >> ~/.zshenv

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, 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")

Using RStudio

For RStudio to use the patio environment created in the previous step, 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

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

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 model

To run the resource model:

pixi run patio

To run the economic model:

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