local dev setup¶
If you use codespaces or devcontainers, you don't need to set up a local development environment. But otherwise, follow these steps to set up some useful utilities.
Check the minimum required dependencies and install the tools you need.
Linux/WSL instructions¶
Minimum required dependencies:¶
- python >= 3.10: we recommend installing python via pyenv.
- poetry: we recommend installing poetry with pipx.
Direnv¶
To load python virtual environments automatically and manage environment variables.
# Enter project
cd <project-folder>
# Install direnv
sudo apt update && sudo apt install direnv
# Add direnv to your shell
echo 'eval "$(direnv hook bash)"' >> ~/.bashrc # if you use bash
echo 'eval "$(direnv hook zsh)"' >> ~/.zshrc # if you use zsh
eval "$(direnv hook bash)" # add to current shell
# Add poetry support to direnv
mkdir -p ~/.config/direnv/
cp .devcontainer/direnvrc ~/.config/direnv/direnvrc
.envrc
file to be loaded.
Allow it by running direnv allow
.
Pyenv¶
For installing and managing (multiple) python versions. You may want to use the system's version and not install pyenv.
Otherwise, follow these instructions.
- Install Python build dependencies:
-
Set up your shell environment for Pyenv
# add env variables to your bash .profile (if you use bash) echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile echo 'eval "$(pyenv init --path)"' >> ~/.profile # add shell integration to bash shell echo 'eval "$(pyenv init -)"' >> ~/.bashrc # add env variables to zsh's .zprofile (if you use zsh) echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zprofile echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zprofile echo 'eval "$(pyenv init --path)"' >> ~/.zprofile # add shell integration to zsh shell echo 'eval "$(pyenv init -)"' >> ~/.zshrc
Pipx¶
For installing python packages in isolated environments.
Poetry¶
To manage package dependencies and virtual environments.
Pre-commit¶
To run code formatting and linting before committing.
In your projects, you should enable pre-commit hooks by running:
Commitizen¶
To help with conventional commits.
Copier¶
To create new repositories from cookie-doh.