Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyYAML artifacts uploaded to pypi.org have missing Python-Requires metadata #398

Open
ngaya-ll opened this issue May 9, 2020 · 2 comments

Comments

@ngaya-ll
Copy link

ngaya-ll commented May 9, 2020

Although PyYaml's setup.py contains a requires_python field, the pypi.org links do not have the expected data-requires-python anchor attribute (see PEP 503). This creates problems for users of older Python versions as pip uses this information to determine which version to download and install.

For example, on Python 3.4:

$ pip install pyyaml
Collecting pyyaml
  Downloading https://files.pythonhosted.org/packages/64/c2/b80047c7ac2478f9501676c988a5411ed5572f35d1beff9cae07d321512c/PyYAML-5.3.1.tar.gz (269kB)
ERROR: PyYAML requires Python '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*' but the running Python is 3.4.10

With the correct metadata, pip could automatically select and install PyYAML 5.2, the latest version with Python 3.4 support.

The reason for this issue seems to be that the Requires-Python metadata property was not provided when these artifacts were uploaded. If using setuptools for PyPI uploads, please switch to twine for future releases to ensure full metadata support. See https://packaging.python.org/tutorials/packaging-projects/#uploading-the-distribution-archives

It would be great if you could also fix the metadata for existing artifacts as well, at least from version 5.3 onward. I believe this can be done using the twine register command.

@perlpunk
Copy link
Member

I managed the last releases. Unfortunately I don't know much about Python packaging.
I was using twine.
The packaging steps are still WIP, and I got the steps from @nitzmahone and put it into this branch: https://github.com/yaml/pyyaml/blob/packaging/release-steps

Maybe @nitzmahone can help?

@nitzmahone
Copy link
Member

nitzmahone commented May 14, 2020

It's actually more complicated than that- the metadata exists properly in the package, but because pyyaml's setup code is so ancient (it's using an unholy marriage of customized distutils and injected setuptools), it prevents the metadata from propagating correctly when publishing to PyPI (even via Twine). I verified a few months back that fully upgrading to setuptools fixes it, but there are changes required to make the heavily customized extension build work properly under setuptools that I haven't had time to make... I think we'd also have to use PyPI's new "yank build" feature to republish updates to older releases that weren't properly declaring the required Python metadata in order to get the desired behavior (and that's assuming that the ancient versions of pip that still work on those dead Python versions will do the right thing). When we get the setup stuff fixed, I'll investigate that to see if it's workable, but it's probably not going to be happening in the next few weeks anyway. In the interim, I'd suggest pinning to an older supported version (though IIRC we haven't actually made any breaking changes yet against 2.6 or 3.4).

Totktonada added a commit to tarantool/tarantool-python that referenced this issue Aug 21, 2020
`pip install pyyaml` fails in AppVeyor on 64-bit Python 3.4 with the
following message (full log is in [1]):

 | Collecting pyyaml
 |   Downloading <...>/PyYAML-5.3.1.tar.gz (269kB)
 | <...>
 | building '_yaml' extension
 | Traceback (most recent call last):
 |   <...>
 |   File "C:\Python34-x64\lib\distutils\msvc9compiler.py", line 287, in query_vcvarsall
 |     raise ValueError(str(list(result.keys())))
 | ValueError: ['path']

It is cumulative effect of several problems.

The first one is that pip does not choose a PyYAML version, which
supports given Python version (it is PyYAML 5.2, see [2]), but tries to
install a last one (it is PyYAML 5.3.1 ATM). There are PyYAML issues
[3], [4] and [5], which are not exacly about this, but looks tightly
related. Despite Python 3.4 is not officially supported in PyYAML, it
works on 3.4 in fact, so it is not the problem per se.

Next, there are no wheels for Python 3.4 for PyYAML 5.3.1 on PyPI (which
is logical), so pip downloads the source tarball and tries to build it.
And the exception shown above is raised.

It looks similar to [6], so I would guess that it is a compiler setup
problem within an AppVeyor Windows image. I started the discussion [7]
regarding it, but we need to work the problem around.

Side note: 32-bit Python 3.4 works fine, the problem appears only for
the 64-bit Python 3.4 build.

In order to workaround the compiler setup problem we can just choose a
PyYAML version for which PyPI provides wheels for the corresponding
platform / Python version / Python build. It is 5.2b1, see [8].

Python 3.4 reaches EOL 2019-03-18 with releasing 3.4.10 (see [9]). I
would not consider it as the reason to drop support of it on our side,
especially when we're tell about a library (our users has its users,
etc) and it is hard to estimate the impact. The problem we meet here is
just about a testing dependency in a particular environment. So let's
keep Python 3.4 support until there will be a better reason to stop.

[1]: https://ci.appveyor.com/project/tarantool/tarantool-python/builds/34769695/job/ww3s69pkuh1n9d1y
[2]: yaml/pyyaml#345
[3]: yaml/pyyaml#281
[4]: yaml/pyyaml#375
[5]: yaml/pyyaml#398
[6]: https://stackoverflow.com/a/43711372/1598057
[7]: http://help.appveyor.com/discussions/problems/28023
[8]: https://pypi.org/project/PyYAML/5.2b1/#files
[9]: https://www.python.org/downloads/release/python-3410/
Totktonada added a commit to tarantool/tarantool-python that referenced this issue Aug 21, 2020
`pip install pyyaml` fails in AppVeyor on 64-bit Python 3.4 with the
following message (full log is in [1]):

 | Collecting pyyaml
 |   Downloading <...>/PyYAML-5.3.1.tar.gz (269kB)
 | <...>
 | building '_yaml' extension
 | Traceback (most recent call last):
 |   <...>
 |   File "C:\Python34-x64\lib\distutils\msvc9compiler.py", line 287, in query_vcvarsall
 |     raise ValueError(str(list(result.keys())))
 | ValueError: ['path']

It is cumulative effect of several problems.

The first one is that pip does not choose a PyYAML version, which
supports given Python version (it is PyYAML 5.2, see [2]), but tries to
install a last one (it is PyYAML 5.3.1 ATM). There are PyYAML issues
[3], [4] and [5], which are not exacly about this, but looks tightly
related. Despite Python 3.4 is not officially supported in PyYAML, it
works on 3.4 in fact, so it is not the problem per se.

Next, there are no wheels for Python 3.4 for PyYAML 5.3.1 on PyPI (which
is logical), so pip downloads the source tarball and tries to build it.
And the exception shown above is raised.

It looks similar to [6], so I would guess that it is a compiler setup
problem within an AppVeyor Windows image. I started the discussion [7]
regarding it, but we need to work the problem around.

Side note: 32-bit Python 3.4 works fine, the problem appears only for
the 64-bit Python 3.4 build.

In order to workaround the compiler setup problem we can just choose a
PyYAML version for which PyPI provides wheels for the corresponding
platform / Python version / Python build. It is 5.2b1, see [8].

Python 3.4 reaches EOL 2019-03-18 with releasing 3.4.10 (see [9]). I
would not consider it as the reason to drop support of it on our side,
especially when we're tell about a library (our users has its users,
etc) and it is hard to estimate the impact. The problem we meet here is
just about a testing dependency in a particular environment. So let's
keep Python 3.4 support until there will be a better reason to stop.

[1]: https://ci.appveyor.com/project/tarantool/tarantool-python/builds/34769695/job/ww3s69pkuh1n9d1y
[2]: yaml/pyyaml#345
[3]: yaml/pyyaml#281
[4]: yaml/pyyaml#375
[5]: yaml/pyyaml#398
[6]: https://stackoverflow.com/a/43711372/1598057
[7]: http://help.appveyor.com/discussions/problems/28023
[8]: https://pypi.org/project/PyYAML/5.2b1/#files
[9]: https://www.python.org/downloads/release/python-3410/
Totktonada added a commit to tarantool/tarantool-python that referenced this issue Aug 21, 2020
`pip install pyyaml` fails in AppVeyor on 64-bit Python 3.4 with the
following message (full log is in [1]):

 | Collecting pyyaml
 |   Downloading <...>/PyYAML-5.3.1.tar.gz (269kB)
 | <...>
 | building '_yaml' extension
 | Traceback (most recent call last):
 |   <...>
 |   File "C:\Python34-x64\lib\distutils\msvc9compiler.py", line 287, in query_vcvarsall
 |     raise ValueError(str(list(result.keys())))
 | ValueError: ['path']

It is cumulative effect of several problems.

The first one is that pip does not choose a PyYAML version, which
supports given Python version (it is PyYAML 5.2, see [2]), but tries to
install a last one (it is PyYAML 5.3.1 ATM). There are PyYAML issues
[3], [4] and [5], which are not exacly about this, but looks tightly
related. Despite Python 3.4 is not officially supported in PyYAML, it
works on 3.4 in fact, so it is not the problem per se.

Next, there are no wheels for Python 3.4 for PyYAML 5.3.1 on PyPI (which
is logical), so pip downloads the source tarball and tries to build it.
And the exception shown above is raised.

It looks similar to [6], so I would guess that it is a compiler setup
problem within an AppVeyor Windows image. I started the discussion [7]
regarding it, but we need to work the problem around.

Side note: 32-bit Python 3.4 works fine, the problem appears only for
the 64-bit Python 3.4 build.

In order to workaround the compiler setup problem we can just choose a
PyYAML version for which PyPI provides wheels for the corresponding
platform / Python version / Python build. It is 5.2b1, see [8].

Python 3.4 reaches EOL 2019-03-18 with releasing 3.4.10 (see [9]). I
would not consider it as the reason to drop support of it on our side,
especially when we're tell about a library (our users has its users,
etc) and it is hard to estimate the impact. The problem we meet here is
just about a testing dependency in a particular environment. So let's
keep Python 3.4 support until there will be a better reason to stop.

[1]: https://ci.appveyor.com/project/tarantool/tarantool-python/builds/34769695/job/ww3s69pkuh1n9d1y
[2]: yaml/pyyaml#345
[3]: yaml/pyyaml#281
[4]: yaml/pyyaml#375
[5]: yaml/pyyaml#398
[6]: https://stackoverflow.com/a/43711372/1598057
[7]: http://help.appveyor.com/discussions/problems/28023
[8]: https://pypi.org/project/PyYAML/5.2b1/#files
[9]: https://www.python.org/downloads/release/python-3410/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants