Poetry: Upload to TestPyPI silently failed.

Created on 15 Dec 2018  路  13Comments  路  Source: python-poetry/poetry

  • [x ] I am on the latest Poetry version.
  • [x ] I have searched the issues of this repo and believe that this is not a duplicate.
  • [x ] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Issue


I tried uploading the test package to TestPyPI using Poetry.

~/s/kk6-demo $ poetry config repositories.testpypi https://test.pypi.org/simple
~/s/kk6-demo $ poetry publish -r testpypi

Publishing kk6-demo (0.1.0) to testpypi
Username: kk6



Password:

 - Uploading kk6-demo-0.1.0.tar.gz 100%
 - Uploading kk6_demo-0.1.0-py3-none-any.whl 100%

As far as looking at the output, the upload seems to be successful. However, when I look at TestPyPI's own project list, I can not find the package I uploaded earlier.

So, trying uploading in the same way using twine as a test, HTTPError: 400 Client Error returned.

~/s/kk6-demo $ poetry run twine upload --repository-url https://test.pypi.org/legacy/ dist/*
Enter your username: kk6
Enter your password:
Uploading distributions to https://test.pypi.org/legacy/
Uploading kk6_demo-0.1.0-py3-none-any.whl
100%|鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 3.77k/3.77k [00:01<00:00, 2.36kB/s]
Uploading kk6_demo-0.1.1-py3-none-any.whl
100%|鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 3.77k/3.77k [00:01<00:00, 3.13kB/s]
Uploading kk6-demo-0.1.0.tar.gz
100%|鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 3.49k/3.49k [00:00<00:00, 9.05kB/s]
NOTE: Try --verbose to see response content.
HTTPError: 400 Client Error: 'None' is an invalid value for Home-Page. Error: Invalid URI See https://packaging.python.org/specifications/core-metadata for url: https://test.pypi.org/legacy/

It seems to be caused by not setting the homepage, so I added the following settings to pyproject.toml.

[tool.poetry]
...
homepage = "https://github.com/kk6/kk6-demo"

When I tried uploading again with Poetry, I succeeded this time.

~/s/kk6-demo $ poetry config repositories.testpypi https://test.pypi.org/legacy/
~/s/kk6-demo $ poetry publish -r testpypi

Publishing kk6-demo (0.1.0) to testpypi
Username: kk6



Password:

 - Uploading kk6-demo-0.1.0.tar.gz 100%
 - Uploading kk6_demo-0.1.0-py3-none-any.whl 100%

This time it was added to https://test.pypi.org/manage/projects/ properly.

If homepage is not set in pyproject.toml, I think that Poetry probably receivedHTTPError: 400 Client Error, but in that case I thought that should be displayed.

Bug Publishing

Most helpful comment

Thanks @brentspector, adding the trailing slash in the config works for me.

Using this fails silently:

poetry config repositories.testpypi https://test.pypi.org/legacy
poetry publish -r testpypi

Adding the slash works, and the package becomes available on testpypi:

poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry publish -r testpypi

In both cases the output is identical.

All 13 comments

Thanks for reporting this!

I am not sure why the upload does not fail when it should but this is definitely a bug.

I will investigate and get back to you.

Related to #239 ?

@jgirardet I guess so. I tried the same thing as your comment on #239 .

>>> subprocess.check_output('poetry --version', shell=True).decode()
'Poetry 0.12.10\n'
>>> subprocess.check_call('poetry publish -r testpypi --username kk6 --password PASSWORD', shell=True)

Publishing kk6-demo (0.1.0) to testpypi
 - Uploading kk6-demo-0.1.0.tar.gz 100%
 - Uploading kk6_demo-0.1.0-py3-none-any.whl 100%
0

Actually, the package could not be uploaded.

Thanks for posting this.

My poetry publish SILENTLY fails, with exit code 0, but

$ poetry add twine --dev
$ poetry run twine upload dist/*

succeeded.

I noticed similar behavior against devpi-server. My mistake was to use url = "https://<internal server url>/kristofferb/dev/simple+/". Using https://<internal server url>/kristofferb/dev/ instead fixed this.

I found by looking at the server log that the server responded with a 200 http code:

2019-01-25 22:21:09,720 INFO  [req4] POST /kristofferb/dev/+simple/
2019-01-25 22:21:09,721 DEBUG [req4] [Wtx2027] in-transaction 2027
2019-01-25 22:21:09,722 INFO  [req4] starting +simple
2019-01-25 22:21:10,372 DEBUG [req4] [Wtx2027] nothing to commit, just closing tx
2019-01-25 22:21:10,372 DEBUG [req4] [Wtx2027] closing transaction at 2027
2019-01-25 22:21:10,373 DEBUG [req4] 200 0.652s serial=2027 length=7718140 type=text/html; charset=UTF-8

Using the correct URL, the log indicates that the server responds with a 200 http code:

2019-01-25 22:22:56,801 INFO  [req9] POST /kristofferb/dev/
2019-01-25 22:22:56,802 DEBUG [req9] [Wtx2027] in-transaction 2027
2019-01-25 22:22:56,826 DEBUG detected 'argon2_cffi' backend, version '18.3.0', with support for 0x13 argon2 hashes
2019-01-25 22:22:57,010 DEBUG [req9] got auth status 'ok' for user 'kristofferb'
 <snip>
2019-01-25 22:22:57,349 DEBUG [req9] [Wtx2027] closing transaction at 2027
2019-01-25 22:22:57,349 DEBUG [req9] 200 0.548s serial=2028 length=0 type=text/html; charset=UTF-8

This behavior is common for most poetry commands I guess.
After running tests it looks like:

$ poetry run pytest
============================= test session starts ==============================
.....
.....

tests/test_iptables.py .........xx........                               [ 65%]
tests/test_resolvers.py .....F...Job succeeded 

This issue with the publish command should be fixed in commit 903514060748496f9c87513ba7fb33ed29158325. It will be released in the next bugfix version.

Version 0.12.12 has just been released!

This bug seems to still be here

>>> subprocess.check_output('poetry --version', shell=True).decode()
'Poetry version 1.0.0\n'
>>> subprocess.check_call('poetry publish -r test-pypi --username erawpalassalg --password PASSWORD', shell=True)

Publishing bli (0.1.0) to test-pypi
 - Uploading bli-0.1.0-py3-none-any.whl 100%
 - Uploading bli-0.1.0.tar.gz 100%
0

using the -v flag doesn't help:

>>> subprocess.check_call('poetry publish -v -r test-pypi --username erawpalassalg --password PASSWORD', shell=True)

Publishing bli (0.1.0) to test-pypi
 - Uploading bli-0.1.0-py3-none-any.whl 100%
 - Uploading bli-0.1.0.tar.gz 100%
0

I am experiencing the bug in Poetry 1.0.3

While uploading to TestPypi, poetry publish showed that it successfully uploaded, but I was unable to find it on the site. It turns out that it was getting a 301 because I missed the trailing / that it needed. Using -vvv did not return any helpful information for troubleshooting. I recommend the following.

1) Output the attempted URL (or offer a way to output what the target repository's registered URL is during upload)
2) Follow 301 automatically (offer a toggle if this is undesired) or output an error stating the location of the redirection.
3) Don't show success when it never reached the target repository. This one might be tricky because of the various ways a private repo might handle publish requests.

Thanks @brentspector, adding the trailing slash in the config works for me.

Using this fails silently:

poetry config repositories.testpypi https://test.pypi.org/legacy
poetry publish -r testpypi

Adding the slash works, and the package becomes available on testpypi:

poetry config repositories.testpypi https://test.pypi.org/legacy/
poetry publish -r testpypi

In both cases the output is identical.

I think the doc should use https://test.pypi.org/simple/ instead of https://foo.bar/simple/ which feels like a fake URL.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nikaro picture nikaro  路  3Comments

EdgyEdgemond picture EdgyEdgemond  路  3Comments

thejohnfreeman picture thejohnfreeman  路  3Comments

etijskens picture etijskens  路  3Comments

AWegnerGitHub picture AWegnerGitHub  路  3Comments