hi-ml

Setting up the Development Environment

Development environment

We suggest using Visual Studio Code (VSCode), available for multiple platforms here. On Windows system, we recommend using WSL, the Windows Subsystem for Linux, because some PyTorch features are not available on Windows. Inside VSCode, please install the extensions that are recommended for this project - they are available in .vscode/extensions.json in the repository root.

Opening the repository

Once you have the repository on your computer, you can open either all projects at once or individual projects separately in VSCode.

Creating a Conda environment

Different projects in this repository use different Conda environments:

Please select the right Python interpreter for your project (or all projects if using the himl-projects workspace) inside VSCode, by choosing “Python: Select Interpreter” from the command palette (Ctrl-Shift-P on VSCode for Windows)

To create the Conda environment himl, please use either

```shell script conda env create –file hi-ml/environment.yml


or use `make` in the repository root folder:

```shell script
make env

Please see the project-specific README files for instructions how to set up the other Conda environments.

Installing pyright

We are using static typechecking for our code via mypy and pyright. The latter requires a separate installation outside the Conda environment. For WSL, these are the required steps (see also here):

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

Close your terminal and re-open it, then run:

nvm install node
npm install -g pyright

Using specific versions of hi-ml in your Python environments

If you’d like to test specific changes to the hi-ml package in your code, you can use two different routes:

pip install -e <your_git_folder>/hi-ml
pip install --extra-index-url https://test.pypi.org/simple/ hi-ml==0.1.0.post165
name: foo
dependencies:
  - pip=23.3
  - python=3.9.18
  - pip:
      - --extra-index-url https://test.pypi.org/simple/
      - hi-ml==0.1.0.post165

Common things to do

The repository contains a makefile with definitions for common operations.

Building documentation

To build the sphinx documentation, you must have sphinx and related packages installed (see build_requirements.txt in the repository root). Then run:

cd docs
make html

This will build all your documentation in docs/build/html.

Setting up your AzureML workspace

Creating and Deleting Docker Environments in AzureML

Testing

For all of the tests to work locally you will need to cache your AzureML credentials. One simple way to do this is to run the example in src/health/azure/examples (i.e. run python elevate_this.py --message='Hello World' --azureml or make example) after editing elevate_this.py to reference your compute cluster.

When running the tests locally, they can either be run against the source directly, or the source built into a package.

Test discovery in VSCode

All tests in the repository should be picked up automatically by VSCode. In particular, this includes the tests in the hi-ml-cpath folder, which are not always necessary when working on the core hi-ml projects.

Creating a New Release

To create a new package release, follow these steps:

Troubleshooting

Debugging a test in VSCode fails on Windows