Setting Up CHAP Core as a Contributor¶
The following is our recommended setup for creating a development environment when working with CHAP Core as a contributor.
If you are an external contributor without write-access to the chap-core repository you will first need to fork the chap-core repository to your own GitHub account.
-
Start by downloading the latest chap-core
masterbranch to a local folder of your choice, either from the main repository or from your own fork: -
If you need to work with and test a specific stable version of CHAP Core codebase, these are stored as version tags. Writing
git tagon the commandline will give you a list of the available version. To switch to a desired version, for instance v1.0.3, you can write: -
If you're a Windows user, read this note about how to simulate a Linux environment using Windows WSL. Before proceeding to the next steps, initiate a wsl session from the commandline:
-
Install the uv package manager if you don't already have it. The benefit of using
uvfor the development environment is that it makes installing dependencies much faster. To read more, check out their documentation.* Fetch and install `uv` from their official website: ```bash $ curl -LsSf https://astral.sh/uv/install.sh | sh ``` * After the installation, restart the linux shell (or wsl if you're on windows) in order for the uv command to become available. -
Install a local version of Python along with all the dependencies. Inside the project folder, run:
Note that
uvcreates a virtual Python environment with all the required packages for you, so you don’t need to do this manually. This environment exists in the.venvdirectory. -
Activate the environment and run the tests to make sure everything is working:
We recommend a setup where you can run the tests directly through the IDE you are using (e.g. Vscode or Pycharm). Make sure that your IDE is using the correct Python environment.
-
Finally, if the tests are passing, you should now be connected to the development version of Chap, directly reflecting any changes you make to the code. Check to ensure that the chap command line interface (CLI) is available in your terminal:
```bash $ chap --help ```
It is also good to see if you can run chap evaluation on an external model. The recommended command is chap eval:
chap eval --model-name https://github.com/dhis2-chap/chap_auto_ewars --dataset-csv example_data/laos_subset.csv --output-file eval.nc --backtest-params.n-splits 2
If the above command runs successfully, an eval.nc file will be generated with the results.
Note: The legacy
chap evaluatecommand is deprecated and will be removed in v2.0.
You have now successfully setup a development version of the chap-cli tool and you are ready to start developing. If you have any problems installing or setting up the environment, feel free to contact us.