pypa / twine

Utilities for interacting with PyPI
https://twine.readthedocs.io/
Apache License 2.0
1.61k stars 308 forks source link

"Unknown distribution format" when uploading #372

Closed cs01 closed 6 years ago

cs01 commented 6 years ago

I keep getting Unknown distribution format: when uploading printed when uploading. The upload seems to work (https://pypi.org/project/pygdbmi/ shows v0.8.3.0). Subsequent uploads give the same message instead of an error about a version number that's already in use.

>> twine upload dist/*
Uploading distributions to https://upload.pypi.org/legacy/
Uploading pygdbmi-0.8.3.0-py2.py3-none-any.whl
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████| 31.3k/31.3k [00:02<00:00, 13.8kB/s]
ValueError: Unknown distribution format: 'pygdbmi-0.8.3.0'
>> twine --version
twine version 1.11.0 (pkginfo: 1.4.2, requests: 2.18.4, setuptools: 39.2.0,
requests-toolbelt: 0.8.0, tqdm: 4.23.4)

.pypirc

[distutils] # this tells distutils what package indexes you can push to
index-servers =
  pypi
  pypitest

[pypi]
username: ...
password: ...
sigmavirus24 commented 6 years ago

ValueError: Unknown distribution format: 'pygdbmi-0.8.3.0'

Something seems to be off about that filename. Can you share the files in dist/?

cs01 commented 6 years ago
drwxr-xr-x  11 1876110778    352 May 26 21:02 pygdbmi-0.8.3.0
-rw-r--r--   1 1876110778  20055 May 26 21:05 pygdbmi-0.8.3.0-py2.py3-none-any.whl
-rw-r--r--@  1 1876110778  22294 May 26 21:05 pygdbmi-0.8.3.0.tar.gz

after removing dist, regenerating (python setup.py sdist bdist_wheel --universal), and running twine again, it worked (well, gave HTTPError: 400 Client Error: File already exists. See https://pypi.org/help/#file-name-reuse for url: https://upload.pypi.org/legacy/).

So this was definitely my error (not sure where that file came from). But I do think this is an opportunity to improve twine's output to mention that it did successfully upload to PyPI before finding the unknown file.

sigmavirus24 commented 6 years ago

So this was definitely my error (not sure where that file came from). But I do think this is an opportunity to improve twine's output to mention that it did successfully upload to PyPI before finding the unknown file.

It sounds like you would like us to determine, somehow, that we've already uploaded the other files in your dist/ directory as well as error early about the unknown/unprocessable file. Am I understanding you correctly?

We don't maintain state on the user's computer. As such, we'd have to make HTTP requests for all three simultaneously to provide you that feedback This would undoubtedly only make the wait for the failure longer. Do you instead have a suggestion for how to make the message we display clearer?

cs01 commented 6 years ago

It sounds like you would like us to determine, somehow, that we've already uploaded the other files in your dist/ directory as well as error early about the unknown/unprocessable file. Am I understanding you correctly?

Yes, it was not clear to me that my package was live on PyPI. And I did not get any errors indicating the package already existed on subsequent runs which was unexpected. I am not familiar with the mechanics of twine/PyPI under the hood, but it seemed like twine should know pretty early on if the version number is invalid, and also be able to notify the user when their package goes live. I am fine with the wait time increasing if the notification is more accurate. And if that's not something you want to take on, that's fine. Just wanted to share my experience as a user.

sigmavirus24 commented 6 years ago

it seemed like twine should know pretty early on if the version number is invalid

It seems I've done a poor job explaining what's going on here. This has nothing to do with version numbers. This is purely because the file you were trying to upload was not a valid artifact. We failed as soon as we encountered it and gave you (perhaps a not clear-enough) message about that fact. We stopped processing everything else. The first attempt you made, the file was uploaded, but perhaps that's also not clear enough from what we show here

>> twine upload dist/*
Uploading distributions to https://upload.pypi.org/legacy/
Uploading pygdbmi-0.8.3.0-py2.py3-none-any.whl
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████| 31.3k/31.3k [00:02<00:00, 13.8kB/s]

For users with more than 3 files in their dist directory, I think that checking every single one is going to be unreasonable. Specifically, many people keep all versions of the project in that directory since twine will skip files that already exist on PyPI if you tell it to.

I appreciate you sharing your experience as a user. I was not trying to discredit it or make you feel like it was invalid. If I did so, I'm sorry.

tony commented 2 years ago

This happened to me when trying to do twine upload build/* instead of twine upload dist/*