Skip to content

Initial Setup

Install Dependencies

Install pyenv (MacOS)

We use python 3.9.11 for the back end in our repo, but python >= 3.9.11 should work in general. You should use pyenv to set up the right python version for the project.

  • Install brew (if not already installed).
  • Install the xz library (if not already installed).
    brew install xz
    
  • Then install pyenv and set the right python version.
    brew install pyenv
    pyenv install 3.9.11
    pyenv local 3.9.11      # You can use global or local.
    
  • Add this to your ~/.zshrc:
    export PYENV_ROOT="$HOME/.pyenv"
    export PATH="$PYENV_ROOT/bin:$PATH"
    eval "$(pyenv init -)"
    
  • Run zsh to open a new shell (with the updated ~/.zshrc).
    zsh
    
  • Check that the version of python is the same as you set to pyenv local.

    python --version
    

    If it doesn't match...

    It might be due to a wrong ordering in your $PATH. Print it and make sure that $PYENV_ROOT/bin is at the beginning. Edit ~/.zshrc accordingly.

    echo $PATH
    

Install Poetry

We use poetry as our dependency manager for the back end.

  • Install poetry.
  • Check that the version of python that poetry uses is the same as you set to pyenv local.

    poetry run python --version
    

    If it prints a warning mentioning another python version...

    You might need to force poetry to use the right python environment.

    poetry env use $(which python)
    

  • Install the dependencies.

    poetry install --extras cpu
    

Docker (Optional)

Docker is needed for different tasks such as releasing and updating the documentation. However, it won't be needed at first to develop and launch the app. You can skip this step and wait until you are required to use it.

  • Install Docker Desktop. If you are using a Mac, check "Apple logo" > "About This Mac" to know if you have a Mac with Intel Chip or a Mac with Apple Chip.
  • Set the memory to at least 9 GB in Docker > Preference > Resources.

Front End

  • Install Node.js version 16. If you need to use different versions of Node on your machine, you may be interested in NVM. Otherwise, the simplest way to install Node on you Mac is to use Homebrew (and follow directions to add this version to your PATH).

    brew install node@16
    
  • Once you've installed Node, you can install yarn.

    npm install -g yarn
    
  • You can then install front-end dependencies, from the webapp folder, using:

    cd webapp
    yarn
    

Setting up the development environment

Install IDE

  • If developing in back end, we recommend installing PyCharm:
    • Install PyCharm.
    • In PyCharm preferences, you can add your existing python virtual environment as the "Python Interpreter", pointing where what poetry run which python prints.
  • If developing in front end, we recommend installing Visual Studio Code:
    • Install Visual Studio Code
    • A pre-defined configuration is available in the repo, to help development. Two things to do:
      • View > Extensions > search for esbenp.prettier-vscode and install it. That's the official Code formatter using prettier by publisher Prettier.
      • File > Open Workspace from File > select azimuth.code-workspace, which will set up two folders: webapp and . (for the rest). In the webapp folder, webapp/.vscode/settings.json will configure Prettier to format your files on save.

Pre-commit Hooks

We installed pre-commit hooks which will format automatically your code with each commit. The first time, you need to run the following command.

poetry run pre-commit install