8

I want to upload packages to pypi.org as mentioned in the Migrating to PyPI.org documentation, but Twine uploads to https://upload.pypi.org/legacy/.

It's available on pypi.python.org/pypi/mypolr, but is not found on pypi.org.

I've tried to read several other questions, tutorials, and guides.

My pip.ini-file (I'm on Windows 10) looks like this:

[distutils]
index-servers =
    pypi

[pypi]

I don't have my username or password stored, so the [pypi] section is empty (as mentioned in migration docs).

I've put the .ini-file in my user folder, and confirmed (per this answer) that it's actually using the one I've set (using environment variable PIP_CONFIG_FILE).

Afraid that I had got something wrong, I also tried without a pip.ini-file to make Twine use its defaults.

I'm using Python 3.6.3 (from Anaconda), and my tools' versions are:

  • Twine 1.9.1 (migration docs says it should be 1.8+)
  • setuptools 38.2.3 (migration docs says it should be 27+)

Whether or not it's relevant, here is some more info:

  • Link to my setup.py
  • setup is imported from setuptools and not distutils.core
  • README.rst is used as long description, but in the PyPi page only first 8 asterix of header is shown. (Compare this with this)
  • The package I upload is version is 0.2.1 (at the time of posting this)
  • setuptools_scm is used to fetch versions from git tags
  • build is made with python setup.py sdist bdist_wheel

Please let me know if there is any other information that could be useful to figure this out.

Thomas Fauskanger
  • 2,536
  • 1
  • 27
  • 42

3 Answers3

11

You appear to be doing everything correctly. Twine is not uploading via legacy PyPI (https://pypi.python.org). It is uploading to the new PyPI (https://pypi.org, a.k.a. "Warehouse") via the original (and so far only) PyPI API, and this API just happens to be named "legacy".

Also, your package is present on Warehouse at https://pypi.org/project/mypolr/; Warehouse search is apparently not production-ready.

jwodder
  • 54,758
  • 12
  • 108
  • 124
  • 1
    Wow, that is amazing, and thanks a lot. If I understand correctly then Twine is set up correctly to work with pypi.org, and it's just that pypi.org is not "ready" yet. – Thomas Fauskanger Nov 30 '17 at 23:30
  • it's weird that Twine STILL, today, tells me it's uploading to legacy, while I can find my package (pymcs) in the Warehouse on pypy.org? Very confusing. – K.-Michael Aye Jun 24 '19 at 04:27
  • 1
    @K.-MichaelAye: Because "legacy" is still the one and only API. – jwodder Jun 24 '19 at 14:00
  • but isn't that an incorrect confusing wording? It then should be saying "using legacy API to upload to current warehouse" or something to that effect? – K.-Michael Aye Sep 27 '19 at 20:46
4

The docs for Warehouse explain this confusing nomenclature. Quotes below are from the front page and from the page about the Legacy API:

Warehouse is a web application that implements the canonical Python package index (repository); its production deployment is PyPI. It replaces an older code base that powered pypi.python.org.

Legacy API

The “Legacy API” provides feature parity with pypi-legacy, hence the term “legacy”.

...

Upload API

The API endpoint served at upload.pypi.org/legacy/ is Warehouse’s emulation of the legacy PyPI upload API. This is the endpoint that tools such as twine and distutils use to upload distributions to PyPI.

In other words, as I understand it:

  • PyPI was once a web application hosted at pypi.python.org. That old application, which no longer runs, is now referred to by the name pypi-legacy.
  • PyPI is now a web application hosted at pypi.org. This new application is named Warehouse. The old pypi.python.org is now just a redirect to pypi.org.
  • In addition to some new endpoints, Warehouse still exposes a couple of API endpoints that pypi-legacy used to have. Because these endpoints were copied across from pypi-legacy, they are together known as the "Legacy API".
  • In addition to that, the upload endpoint within Warehouse's Legacy API is served from the URL path /legacy, a naming choice which again reflects the fact that it is a (partial) reimplementation of the endpoint used for uploads in pypi-legacy.

This all seems more confusing than it needs to be, but it is what it is.

Mark Amery
  • 143,130
  • 81
  • 406
  • 459
  • 1
    to me `legacy` implies `deprecated` and so i worry that there will be a new one soon --> **HOWEVER** according to this post **there is only one API** and there are **no future plans to create a new one or deprecate the existing `legacy`**. so `legacy` is more a name instead an adjective/description. – Trevor Boyd Smith Aug 18 '23 at 14:35
1

In case anyone else is coming here from google, mystified why their uploads are failing, don't forget to check https://status.python.org/ to make sure there isn't an outage. Sometimes you just gotta wait :p

snowskeleton
  • 644
  • 7
  • 7