Global config for poetry is in: ~/.config/pypoetry
Local config for poetry, whatever dir... poetry.toml
Configure project to store config locally
Create new poetry config for a project
poetry init
Add a new dependency, in example below requests.
poetry add requests
Find out where the virtualenv is located:
poetry run which python
or
poetry env info --path
View / verify config being used by poetry
poetry config --list
Local configs can go into the projects poetry.toml, example:
think that any parameter defined in the config can also be described in this file
[virtualenvs]
create = true
path = '.venv'
in-project = true
Sometimes you want to have control over where the virtual env is created. For example a docker compose config.
# env vars that will control how poetry behaves
export POETRY_NO_INTERACTION=1
export POETRY_VIRTUALENVS_IN_PROJECT=0
export POETRY_VIRTUALENVS_CREATE=0
export POETRY_CACHE_DIR=/tmp/poetry_cache
export VIRTUAL_ENV=/app/docker_venv
# create the virtual env outside of poetry and activate
python -m venv $VIRTUAL_ENV; . $VIRTUAL_ENV/bin/activate
# install deps into the active virtualenv
poetry install --without dev --no-root -v && rm -rf $POETRY_CACHE_DIR