5

Why is this creating 2 tar.gz files, ‘ python setup.py sdist? I am trying to upload using twine upload -r pypitest dist/*.tar.gz and i get error saying

HTTPError: 400 Client Error: Only one sdist may be uploaded per release. for url: https://test.pypi.org/legacy/
ERROR: Job failed: exit code 1

Here is the full setup.py

Ciasto piekarz
  • 7,853
  • 18
  • 101
  • 197
  • How could we know without looking into your code, especially `setup.py`? – phd May 23 '18 at 19:59
  • @phd I have added link to `setup.py` have a a look, thanks. – Ciasto piekarz May 24 '18 at 02:36
  • Gitlab asked my password and then displayed error 404. A private repository, it seems. – phd May 24 '18 at 05:15
  • @phd sorry about that, I have made my repo public. – Ciasto piekarz May 24 '18 at 06:17
  • As stated in [PEP 527](https://www.python.org/dev/peps/pep-0527/#limiting-number-of-sdists-per-release): _Having multiple sdists often times can account for strange bugs that only expose themselves based on which sdist that the person used. To resolve this, this PEP proposes to allow one, and only one, sdist per release of a project._ What do you have in the `dist` dir when uploading? Run `ls -l dist/*.tar.gz`, there are probably more than one source dists in there. – hoefling May 24 '18 at 17:22
  • @hoefling I do not know what is generating two files, as you can see in my opening post I mentioned I am only running `python setup.py sdist` – Ciasto piekarz May 25 '18 at 02:32
  • Why do you think they are generated by sdist? `rm dist/*.tar.gz && python setup.py sdist && ls -1 dist/*.tar.gz | wc -l`, what number do you get? – hoefling May 27 '18 at 13:17
  • The problem is that a lot of twine tutorials tell you to do `twine upload dist/*` without giving more specific info, so people end up here after they've bumped their package to the next version and they hit this error. – shacker Apr 28 '23 at 00:55

2 Answers2

5

Looks like your command twine upload -r pypitest dist/*.tar.gz is matching more than one tar.gz files and trying to upload them.

You can either be more specific with your command to refer to only one of these packages e.g. twine upload -r pypitest dist/yourPackageName.tar.gz, or simply remove the other tar.gz file(s) in the dist directory

Ed Harrod
  • 3,423
  • 4
  • 32
  • 53
1

As @ech said, this error will show up when you are trying to upload multiple tar.gz files for the same release.

However this means that the command did upload some of your .tar.gz files, all subsequent uploads will fail with the "Only one sdist may be uploaded per release" error

You can check out the files that were uploaded by going to https://test.pypi.org/project/<projectname>/

Romuald Brunet
  • 5,595
  • 4
  • 38
  • 34