-
Notifications
You must be signed in to change notification settings - Fork 327
Description
It seems there might be some weirdness with defining the pypi repo url related to #203 changes which exist in 1.8.1
Case 1
With the following variables set:
export TWINE_REPOSITORY_URL=https://pypi.example.domain
export TWINE_PASSWORD=hahagtfo
export TWINE_USERNAME=project-user
and a ~/.pypirc either with or without contents (this one is empty), and upload works just fine:
└[~/arrovenv/project]> twine upload dist/*
Uploading distributions to https://pypi.example.domain/
Uploading project-0.1b1.dev0-py35-none-any.whl
[================================] 21581/21581 - 00:00:01
However, if I rm the ~/.pypirc file (leaving all variables the same), I get:
└[~/arrovenv/project]> twine upload dist/*
Uploading distributions to https://upload.pypi.org/legacy/
Uploading project-0.1b1.dev0-py35-none-any.whl
[================================] 21581/21581 - 00:00:00
HTTPError: 403 Client Error: Invalid or non-existent authentication information. for
url: https://upload.pypi.org/legacy/
From this, it seems like twine won't even read the variables if a .pypirc file doesn't exist.
Case 2
Additionally, if I have the following variables defined:
export TWINE_REPOSITORY=https://pypi.example.domain
export TWINE_REPOSITORY_URL=https://pypi.example.domain
export TWINE_PASSWORD=hahagtfo
export TWINE_USERNAME=project-user
and no ~/.pypirc in existence, upload works just fine.
Case 3
Well ok...what if just TWINE_REPOSITORY is defined with my url?
Either with or without a ~/.pypirc in existence,
export TWINE_REPOSITORY=https://pypi.example.domain
export TWINE_PASSWORD=hahagtfo
export TWINE_USERNAME=project-user
I receive an error about a problem with configuration:
└[~/arrovenv/project]> twine upload dist/*
KeyError: "Missing 'https://pypi.example.domain/' section from the configuration
file\nor not a complete URL in --repository.\nMaybe you have a out-dated '~/.pypirc'
format?\nmore info: https://docs.python.org/distutils/packageindex.html#pypirc\n"
Conclusion
There is definitely something going on here. If all I should need, given I don't have a ~/.pypirc, is a url+credentials, why do I have to provide the URL in two separate variables?
In my opinion, Case 1 should work without a ~/.pypirc, Case 2 shouldn't ever be necessary, and Case 3 should work.
I want to thank @sigmavirus24 for his work on getting this feature merged and in 1.8.1. Hopefully with a few minor changes, we can make it work swimmingly for everyone ;)