python-poetry / poetry

Python packaging and dependency management made easy
https://python-poetry.org
MIT License
31.69k stars 2.27k forks source link

publish: support url as argument to --repository option #3068

Open abn opened 4 years ago

abn commented 4 years ago

A common scenario when using poetry under CI environments is to rely on environment variables to perform a publish operation. For example,

export POETRY_REPOSITORIES_TESTPYPI_URL=https://test.pypi.org/legacy/
poetry publish --build --repository testpypi --username foo --password bar

We should improve this experience by support valid url's as arguments to the --repository option so that the above can be achieved like so.

poetry publish --build --repository https://test.pypi.org/legacy/ --username foo --password bar
MAX-EINSTEIN commented 4 years ago

@abn I m getting started on this. Can you please point out the file where the changes need to be made?

abn commented 4 years ago

@MAX-EINSTEIN thank you. You can submit a PR to master for this one. You can start by looking at the following:

Just need to check if it is a valid url first, also use the netloc (eg: "testpy.pypi.org") in the console logs instead of the usual name used, we do not want to log the entire url as it may contain credentials.

Hope this helps.

Be sure to update documentation (in help message and doc) and also add both good and bad test cases.

MAX-EINSTEIN commented 4 years ago

The tests failed because I m importing urlparse from urllib.parse. Is this project using python 2?

abn commented 4 years ago

Poetry at present supports Python 2.7 and 3.5+. Hence why compatibility calls need to be made. This will change soon, but until then you can use the compat module as seen here.

Hagkal commented 2 years ago

looks like this issue was forsaken, so i've made the needed changes and added a PR. roughly based on previous closed PR with fixes and proper tests poetry is now python 3.6+ so no problem with direct urlparse import