Last active
December 10, 2020 22:18
-
-
Save Jim-Holmstroem/f191905eb2e52ecad4858f8323548fce to your computer and use it in GitHub Desktop.
poetry entrypoint to be able to just run a command within the poetry shell (like pytest in CI or something similar). Makes `poetry shell` actually behave like a shell and can be used as ENTRYPOINT in a docker container and it wil behave like a bash entrypoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
COMMAND=$@ | |
set -x | |
command -v poetry > /dev/null || (echo missing poetry && exit 3) | |
if [[ -v ${COMMAND} ]]; then | |
poetry shell | |
else | |
bash -c ". .venv/bin/activate && $(printf ' %q' "$@")" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
NOTE. Just realized that you can use poetry run for the case you use a command
and for docker you can even use
to get it to behave like poetry_entrypoint.sh above