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.
Once you have the repository on your computer, you can open either all projects at once or individual projects separately in VSCode.
- To open all projects at once, use VSCode's "Open Workspace from File", and
select
himl-projects.code-workspace. - To open individual projects, use VSCode's "Open Folder", and select one of the
folders
hi-ml-azure,hi-ml, orhi-ml-cpath
Different projects in this repository use different Conda environments:
- The
himlConda environment should be used for work on thehi-mlandhi-ml-azureprojects. - The
HimlHistoConda environment should be used for work onhi-ml-cpath.
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
conda env create --file hi-ml/environment.ymlor use make in the repository root folder:
make envPlease see the project-specific README files for instructions how to set up the other Conda environments.
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 | bashClose your terminal and re-open it, then run:
nvm install node
npm install -g pyrightIf you'd like to test specific changes to the hi-ml package in your code, you can use two different routes:
- You can clone the
hi-mlrepository on your machine, and usehi-mlin your Python environment via a local package install:
pip install -e <your_git_folder>/hi-ml- You can consume an early version of the package from
test.pypi.orgviapip:
pip install --extra-index-url https://test.pypi.org/simple/ hi-ml==0.1.0.post165- If you are using Conda, you can add an additional parameter for
pipinto the Condaenvironment.ymlfile like this:
name: foo
dependencies:
- pip=20.1.1
- python=3.7.3
- pip:
- --extra-index-url https://test.pypi.org/simple/
- hi-ml==0.1.0.post165The repository contains a makefile with definitions for common operations.
make check: Runflake8andmypyon the repository.make test: Runflake8andmypyon the repository, then all tests viapytestmake pip: Install all packages for running and testing in the current interpreter.make conda: Update the hi-ml Conda environment and activate it
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 htmlThis will build all your documentation in docs/build/html.
- In the browser, navigate to the AzureML workspace that you want to use for running your tests.
- In the top right section, there will be a dropdown menu showing the name of your AzureML workspace. Expand that.
- In the panel, there is a link "Download config file". Click that.
- This will download a file
config.json. Move that file to both of the foldershi-ml/testhimlandhi-ml/testazureThe fileconfig.jsonis already present in.gitignore, and will hence not be checked in.
- Passing a
docker_base_imageintosubmit_to_azure_if_neededcauses a new image to be built and registered in your workspace (see docs for more information). - To remove an environment use the az ml environment delete function in the AzureML CLI (note that all the parameters need to be set, none are optional).
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.
-
To run the tests against the source directly in the local
srcfolder, ensure that there is no wheel in thedistfolder (for example by runningmake clean). If a wheel is not detected, then the localsrcfolder will be copied into the temporary test folder as part of the test process. -
To run the tests against the source as a package, build it with
make build. This will build the localsrcfolder into a new wheel in thedistfolder. This wheel will be detected and passed to AzureML as a private package as part of the test process.
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.
To create a new package release, follow these steps:
- On the repository's github page, click on "Releases", then "Draft a new release"
- In the "Draft a new release" page, click "Choose a tag". In the text box, enter a (new) tag name that has
the desired version number, plus a "v" prefix. For example, to create package version 0.12.17, create a
tag
v0.12.17. Then choose "+ Create new tag" below the text box. - Enter a "Release title" that highlights the main feature(s) of this new package version.
- Click "Auto-generate release notes" to pull in the titles of the Pull Requests since the last release.
- Before the auto-generated "What's changed" section, add a few sentences that summarize what's new.
- Click "Publish release"
- Symptom: Debugging just does not seem to do anything
- Check: Debug Console shows error
from _sqlite3 import *: ImportError: DLL load failed: The specified module could not be found. - Fix: see here
- Run
conda info --envsto see where your Conda environment lives, then placesqlite3.dllinto theDLLsfolder inside of the environment