-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for configuring Poetry via env vars (POETRY_*
)
#1700
Comments
@claireramming Hi! Thank you for filing this :-) The Python buildpack hasn't historically exposed app config vars (apart from However, I would like to see if we can change this in the future (which would allow you to use the (The buildpack already has some rudimentary filtering here, however, we also need to check for additional env vars, plus cover the case where env vars have been set by a duplicate Python buildpack.) In the meantime you could create a Poetry config file manually in a For example in #!/usr/bin/env bash
set -euo pipefail
# See: https://python-poetry.org/docs/configuration/
POETRY_CONFIG_DIR="${HOME}/.config/pypoetry"
echo "Creating Poetry auth.toml..."
mkdir -p "${POETRY_CONFIG_DIR}"
cat >"${POETRY_CONFIG_DIR}/auth.toml" <<EOF
[http-basic.<EXAMPLE_INDEX_NAME>]
username = "${EXAMPLE_PRIVATE_PYPI_USERNAME}"
password = "${EXAMPLE_PRIVATE_PYPI_PASSWORD}"
EOF (This approach should only be used for secrets; for any other Poetry config, add it to a project-local Alternatively, it should also be possible to configure credentials via a |
POETRY_*
)
(Tracking adding support for configuring Poetry via env vars internally in GUS-W-17309193) |
Thanks @edmorley! I had a feeling I was underestimating the pre-compile step. That should work for us for now. We actually had gone with the |
I have several applications that use poetry and several of the packages in each app need to be installed via a private repository. Previously I was able to install these in my apps using a requirements.txt that installed poetry, then a post_compile script that set poetry config vars for http basic sign-in to our private repository before calling poetry install.
With the new buildpack updates that allow poetry to be used out of the box, I'm struggling to figure out how to correctly pass my private repository user/password since I can no longer call my config command directly before
poetry install
is called (I don't think pre_compile will work here since poetry needs to be installed first). According to poetry I could use a config.toml file, but since one of the vars is a pw I don't want to expose that. Another option via poetry is that I should be able to set ENV vars to replace the config command that I used to call before running poetry install (poetry doc here) but poetry in Heroku does not seem to be picking up on my POETRY_ env vars, even though from what I can tell, it should be passing them... Previously with the post_compile config command I was setting the user/pass also with env vars (ex:poetry config http-basic.my-pypi "$PYPI_USERNAME" "$PYPI_PASSWORD"
) and it was working fine.The text was updated successfully, but these errors were encountered: