- Python 3.10.5
- Poetry dependency management
- Base Docker image: python:3.10.5-bullseye (debian)
- Authored by Kyle Clark - kyleaclark.com
Note: Instructions are specific to macOS. Steps may vary.
- Install pyenv for python version management - https://github.com/pyenv/pyenv
- Update pyenv if previously installed e.g. via brew
brew upgrade pyenv
- Install poetry for python dependency management - https://python-poetry.org/docs/#installation
- Update poetry if necessary (optional):
poetry self update
- Add pyenv path to profile e.g. add
export PYENV_ROOT="$HOME/.pyenv
+export PATH="$PYENV_ROOT/bin:$PATH"
- Add poetry path to profile e.g. add
export PATH="$HOME/.poetry/bin/:PATH
- Install python version:
pyenv install 3.10.5
- Set python version within the repo directory:
pyenv local 3.10.5
- Set the poetry env version of python:
poetry env use ~/.pyenv/versions/3.10.5/bin/python
- Install python application dependencies:
poetry install
- Open PyCharm Preferences
- Open Project Interpeter
- Add existing Virtualenv Environment e.g.
/Users/<username>/Library/Caches/pypoetry/virtualenvs/<poetry-name>/bin/python
- Run
app/main.py
docker build --target application -f Dockerfile -t py-debian-poetry .
docker run --user=appuser --env APP_ENV=DEV py-debian-poetry
docker build --target testing -f Dockerfile -t py-debian-poetry .
docker run --user=appuser --env APP_ENV=DEV py-debian-poetry
- Poetry documentation - https://python-poetry.org/docs/
poetry install
- Install dependencies from poetry.lock - https://python-poetry.org/docs/cli/#installpoetry update
- Update poetry.lock from pyproject.toml - https://python-poetry.org/docs/cli/#updatepoetry add
- Add a dependency into pyproject.toml - https://python-poetry.org/docs/cli/#addpoetry remove
- Remove a dependency in pyproject.toml and update poetry.lock - https://python-poetry.org/docs/cli/#remove