poetry
poetry copied to clipboard
Use env vars if either `--username` or `--password` (or both) is missing
Pull Request Check List
Resolves: #5526
- [ ] Added tests for changed code.
- [ ] Updated documentation for changed code.
This PR changes authentication logic for publishing:
- If both
username
andpassword
is missing, consider PyPI token env var. - If no PyPI token and either
username
orpassword
is missing, consider http basic env var for the missing field.
Previously, env vars were only considered if both CLI options where missing. This PR effectively makes it possible to mix the CLI options with the env vars.
This way both
poetry config repositories.myrepo $REPO_URL \
&& POETRY_HTTP_BASIC_MYREPO_PASSWORD=$PASSWORD \
poetry publish -r myrepo -u $USERNAME
poetry config repositories.myrepo $REPO_URL \
&& POETRY_HTTP_BASIC_MYREPO_USERNAME=$USERNAME \
poetry publish -r myrepo -p $PASSWORD
will work. I am doubtful about whether it is worth supporting the second use case.
I'm still not sure on this myself, but I would like to see tests (plus dropping the second case) to consider this for merging.