Dev environment - s-allius/tsun-gen3-proxy GitHub Wiki

Development Setup

For easy contribution here you find the recommended setup:

  1. Update or install Homebrew On MacOS you should use home-brew for installing the required tools. Before you install new things, please check your installation and update home-brew:

    brew doctor
    brew update
    

    If you have no home-brew you can easily install it:

    xcode-select --install
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    echo >> /Users/sallius/.zprofile
    echo 'eval "$(/usr/local/bin/brew shellenv)"' >> /Users/sallius/.zprofile
    eval "$(/usr/local/bin/brew shellenv)"
    
  2. Install 'vscode' from code.visualstudio.com

    brew install --cask visual-studio-code
    
  3. Install 'docker-desktop' from www.docker.com

    brew install --cask docker
    

    In this project we build multiarch container and use attestations. Please check if you have to enable cantainerd usage on your system for supporting this:

  4. Install readline, xz and gettext

    brew install readline xz gettext
    
  5. Install pyenv so we can easily switch the Python version

    A description how to install pyenv you will find here: pyenv project

    Then install pyenv and set some environments for your shell

    brew install pyenv
    
    echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zprofile
    echo '[ -d $PYENV_ROOT/bin ](/s-allius/tsun-gen3-proxy/wiki/--d-$PYENV_ROOT/bin-) && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zprofile
    echo 'eval "$(pyenv init -)"' >> ~/.zprofile
    
  6. Download repositories

    mkdir tsun
    cd tsun
    git clone https://github.com/s-allius/tsun-gen3-proxy.git
    git clone https://github.com/s-allius/tsun-gen3-proxy.wiki.git
    git clone https://github.com/s-allius/ha-addons.git
    
  7. Setup a virtual environment with pyenv and venv

    Start vscode and enter the workspace of the proxy:

    cd tsun-gen3-proxy
    code tsun.code-workspace
    

    Then open a new terminal (zsh) for the working-directory tsun-gen3-proxy and create the python environment with the required python packages:

    make install
    
  8. Install vscode packages: Python, Pylance, Python Debugger, Docker, Flake8, yUML, Markdown All In One, markdownlint, Coverage Gutters, GitHub Pull Requests, Better Jinja, Git Graph

  9. Optional: install hadolint for Dockerfile checking

    brew install hadolint
    

    and install the vscodepackage: hadolint

  10. Create .env file and build your first docker container or Home Assistant Add-on

    Save the .env-example file as .env to create a new file. Now set the variable in the file with your values. Build a docker container:

    make dev
    

    or build a Home Assistant Add-on:

    make addon-dev