This project is managed by Poetry
Install PyEnv using Brew:
brew install pyenv
Add this to your ~/.zshrc or ~/.bashrc depending on what you use. Documentation copied from here
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
brew install poetry
poetry config virtualenvs.in-project true
Poetry apparently has trouble initializing the Python version itself, so you'll have to force it to use the correct version
At the time of this writing, the correct version is 3.10, so just run:
poetry env use 3.10
And it'll switch the python version to the correct one. You only need to do this once
Have poetry set up all of the configs
poetry install
Add this to your ~/.zshrc:
This automatically spawns a new poetry shell whenever you cd
into a directory with a poetry env
### Autoomatically activate virtual environment
function auto_poetry_shell {
if [ -f "pyproject.toml" ] ; then
source ./.venv/bin/activate
fi
}
function cd {
builtin cd "$@"
auto_poetry_shell
}
auto_poetry_shell
brew install pre-commit
pre-commit install