-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
RuntimeError thrown when executing poetry publish -r <name>
with environment variable POETRY_REPOSITORIES_<NAME>
set
#2204
Comments
POETRY_REPOSITORIES_<NAME>
not taken into account by poetry publish -r <name>
POETRY_REPOSITORIES_<NAME>
not taken into account by poetry publish -r <name>
(RuntimeError thrown)
POETRY_REPOSITORIES_<NAME>
not taken into account by poetry publish -r <name>
(RuntimeError thrown)poetry publish -r <name>
with environment variable POETRY_REPOSITORIES_<NAME>
set
Thank you for the excellent issue description! I encountered the same issue on Poetry 1.0.9 and your workaround worked like a charm. |
For us it's working the following way :
Poetry version 1.0.5 |
Had the same problem 😭 |
I am sad to see that this is two years old and not fixed. I am having the same issue, trying to use
Would be great to see it fixed soon, moving to twine in the meantime |
This is a documentation issue. The expected env var is #9121 should resolve documentation issue. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I am on the latest Poetry version.
I have searched the issues of this repo and believe that this is not a duplicate.
If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).OS version and name: 10.15.3 Mac OS X
Poetry version: 1.0.5
Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/esciara/dfc058348e597f8586d4f678cc163182
Issue
According to the doc on using environment variables for configuration, I should be able to declare an alternative package repository to publish to by setting an environment variable of format
POETRY_REPOSITORIES_<NAME>
(likePOETRY_REPOSITORIES_MYREPO
).However, when running the following commands:
The following error is thrown:
This is due to the fact that the following code for storing the config
poetry/poetry/console/commands/config.py
Lines 168 to 170 in 754dbf8
transforms
"repositories.<name>"
into"repositories.<name>.url"
, and the following code for publishingpoetry/poetry/masonry/publishing/publisher.py
Lines 51 to 56 in 754dbf8
looks for
"repositories.<name>.url"
.However, the code handling environment variables (in the
poetry.config.config.Config.get
method) does not treat thePOETRY_REPOSITORIES_<NAME>
environment variables in any particular way, and hence presents with an equivalent to"repositories.<name>"
, not"repositories.<name>.url"
:poetry/poetry/config/config.py
Lines 109 to 115 in 754dbf8
Workaround
A workaround to this is to add
_URL
as a suffix to the variables (herePOETRY_REPOSITORIES_MYREPO_URL
), but this does not follow the simple and elegant rule for setting poetry though environment variables as defined in the doc.Corrective options
There are several way this could be corrected:
Option 1: change the config setting
repositories.<name>
torepositories.<name>.url
repositories.<name>
.url
does not seem to make much sens - appart perhaps for config file readability, which IMHO is questionable - since there is no other setting required to repositories than their urlOption 2: change the config setting storage from
repositories.<name>.url
torepositories.<name>
.url
repositories.<name>.url
when searching forrepositories.<name>
Option 3: apply to the environment variables the same transformation that that to the comfig setting (
POETRY_REPOSITORIES_<NAME>
transformed on the fly to the equivalent ofPOETRY_REPOSITORIES_<NAME>_URL
).url
Any preferred option? My personal vote goes as first best for option 2 with an upgrade process and as second best to option 3.
The text was updated successfully, but these errors were encountered: