poetry: Upload to TestPyPI silently failed.

  • [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 received HTTPError: 400 Client Error, but in that case I thought that should be displayed.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 4
  • Comments: 16 (6 by maintainers)

Commits related to this issue

Most upvoted comments

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.

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

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.

I am experiencing the bug in Poetry 1.0.3

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

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

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