poetry#
End-to-end walk-through with poetry 1.8 or later. Poetry works
with projects instead of environments: its commands need a directory with a
pyproject.toml file, selected with -C.
Install poetry#
export POETRY_HOME=$HOME/.local/poetry
curl -sSL https://install.python-poetry.org | python3 -
export PATH=$POETRY_HOME/bin:$PATH
export POETRY_HOME=$HOME/.local/poetry
curl -sSL https://install.python-poetry.org | python3 -
export PATH=$POETRY_HOME/bin:$PATH
$env:POETRY_HOME = "$env:USERPROFILE\.local\poetry"
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
$env:PATH = "$env:POETRY_HOME\bin;$env:PATH"
Producer side#
Create a project, install ewoks in it and store a workflow with the packages
of that project as its requirements. The environment is created inside the project, so
that its pyproject.toml and poetry.lock are stored as well.
poetry new ewoks_producer
poetry -C ewoks_producer config virtualenvs.in-project true --local
poetry -C ewoks_producer add ewoks
poetry -C ewoks_producer run ewoks convert demo "$PWD/demo.json" --test
poetry new ewoks_producer
poetry -C ewoks_producer config virtualenvs.in-project true --local
poetry -C ewoks_producer add ewoks
poetry -C ewoks_producer run ewoks convert demo "$PWD/demo.json" --test
poetry new ewoks_producer
poetry -C ewoks_producer config virtualenvs.in-project true --local
poetry -C ewoks_producer add ewoks
poetry -C ewoks_producer run ewoks convert demo "$PWD\demo.json" --test
Install any package that provides tasks instead of
ewoks for a real workflow. Poetry 2 resolves the arguments of poetry run
relative to the project directory, so the workflow paths are absolute.
Re-producer side#
Only ewoks itself is needed to recreate the environment of demo.json
poetry new ewoks_reproducer
poetry -C ewoks_reproducer config virtualenvs.in-project true --local
poetry -C ewoks_reproducer add ewoks
poetry -C ewoks_reproducer run ewoks install "$PWD/demo.json" --yes --env-root "$PWD/ewoks_envs"
poetry new ewoks_reproducer
poetry -C ewoks_reproducer config virtualenvs.in-project true --local
poetry -C ewoks_reproducer add ewoks
poetry -C ewoks_reproducer run ewoks install "$PWD/demo.json" --yes --env-root "$PWD/ewoks_envs"
poetry new ewoks_reproducer
poetry -C ewoks_reproducer config virtualenvs.in-project true --local
poetry -C ewoks_reproducer add ewoks
poetry -C ewoks_reproducer run ewoks install "$PWD\demo.json" --yes --env-root "$PWD\ewoks_envs"
The environment of the workflow is a poetry project in ewoks_envs/demo with the
virtual environment in its .venv directory.
Execute the workflow#
poetry -C ewoks_reproducer run ewoks execute --env "$PWD/ewoks_envs/demo" "$PWD/demo.json" --outputs=all
poetry -C ewoks_reproducer run ewoks execute --env "$PWD/ewoks_envs/demo" "$PWD/demo.json" --outputs=all
poetry -C ewoks_reproducer run ewoks execute --env "$PWD\ewoks_envs\demo" "$PWD\demo.json" --outputs=all
Clean up#
rm -rf ewoks_producer ewoks_reproducer ewoks_envs demo.json
rm -rf ewoks_producer ewoks_reproducer ewoks_envs demo.json
Remove-Item -Recurse -Force ewoks_producer, ewoks_reproducer, ewoks_envs, demo.json