Menu

#490 SyntaxError: future feature annotations is not defined with version 0.18.4 on Python 3.6

resolved
nobody
None
major
bug
2023-11-03
2023-11-02
No

The package version 0.18.4 fails to install on Python 3.6 with:

$ python -c "from ruamel.yaml import YAML"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/maiera/virtualenvs/zhmc36/lib/python3.6/site-packages/ruamel/yaml/__init__.py", line 50, in <module>
    from .cyaml import *  # NOQA
  File "/Users/maiera/virtualenvs/zhmc36/lib/python3.6/site-packages/ruamel/yaml/cyaml.py", line 3, in <module>
    from _ruamel_yaml import CParser, CEmitter  # type: ignore
  File "_ruamel_yaml.pyx", line 18, in init ruamel.yaml.clib._ruamel_yaml
  File "/Users/maiera/virtualenvs/zhmc36/lib/python3.6/site-packages/ruamel/yaml/reader.py", line 25, in <module>
    from ruamel.yaml.util import RegExp
  File "/Users/maiera/virtualenvs/zhmc36/lib/python3.6/site-packages/ruamel/yaml/util.py", line 13, in <module>
    from .compat import StreamTextType  # NOQA
  File "/Users/maiera/virtualenvs/zhmc36/lib/python3.6/site-packages/ruamel/yaml/compat.py", line 3
    from __future__ import annotations
    ^
SyntaxError: future feature annotations is not defined

With ruamel.yaml version 0.18.3, it still worked:

$ python -c "from ruamel.yaml import YAML"

From the Trove classifiers, it seems versions 0.18.x support Python >= 3.7, and on those Python versions it actually works.

The issue is that the ruamel-yaml package does not specify in a way pip can understand it what the minimum Python version is.

This can be fixed by having python_requires: '>=3.7' in the setup() call.

The workaround for packages that use ruamel.yaml on Python 3.6 is to pin the version to <0.17.22 which (according to its Trove classifiers) has increased the minimum Python version from 3.5 to 3.7:

ruamel.yaml>=0.17.21,<0.17.22; python_version == '3.6'
ruamel.yaml>=0.17.21; python_version >= '3.7'

Discussion

  • Anthon van der Neut

    • status: open --> wont-fix
     
  • Anthon van der Neut

    I tried python_requires: '>=3.x' with the result that I did not get a single .whl package, that was not acceptable to me used to having a single Python 2+3 wheel package.

    I notified in the README to pin the version you are using, that is especially important if you work with a Python version that has been EOL for over a year and a half. In the mean time 3.7 has been EOL-d as well.

    I might retry this and adapt my release pipeline, but not in the short term.

     
  • Isiah Phares

    Isiah Phares - 2023-11-03

    This bug is causing alot of issues with other modules that depend on it. Since you do not update your compatibility correctly pip install things that 0.18.4 is compatible even when it is not. python 3.6.8 works fine with 0.17.40 but not any of the 0.18.x builds

     
    • Anthon van der Neut

      @Isiah that is not very helpful. instead of vaguely referencing "other modules" provide the actual package names of packages that have incorrectly pinned the version of ruamel.yaml
      You can easily get that by e.g.. using ~/Downloads pipdeptree -r -w silence -p ruamel.yaml | grep '^ -'

       
  • Anthon van der Neut

    • status: wont-fix --> resolved
     
  • Anthon van der Neut

     

Log in to post a comment.

MongoDB Logo MongoDB