alecthomas / voluptuous

CONTRIBUTIONS ONLY: Voluptuous, despite the name, is a Python data validation library.
https://pypi.org/project/voluptuous
BSD 3-Clause "New" or "Revised" License
1.82k stars 218 forks source link

Version 0.14.0 allows pip to be installed on Python 2.7 #492

Closed andy-maier closed 11 months ago

andy-maier commented 11 months ago

Version 0.14.0 introduced the use of type hints, but its package definition does not require Python 3.6 or higher.

The Trove classifiers in the setup.py file state Python 2.7 and 3.6 and higher, but pip does not use that information, so pip happily installs 0.14.0 on Python 2.7, resulting in:

$ pip install voluptuous==0.14.0
Collecting voluptuous==0.14.0
  Downloading voluptuous-0.14.0.tar.gz (49 kB)
     |████████████████████████████████| 49 kB 2.7 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /Users/maiera/virtualenvs/zhmc27/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/lh/v0_07k9d7dbfqdytfzzxks3r0000gn/T/pip-install-hJvLr2/voluptuous/setup.py'"'"'; __file__='"'"'/private/var/folders/lh/v0_07k9d7dbfqdytfzzxks3r0000gn/T/pip-install-hJvLr2/voluptuous/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/lh/v0_07k9d7dbfqdytfzzxks3r0000gn/T/pip-pip-egg-info-u7zqr9
         cwd: /private/var/folders/lh/v0_07k9d7dbfqdytfzzxks3r0000gn/T/pip-install-hJvLr2/voluptuous/
    Complete output (10 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/lh/v0_07k9d7dbfqdytfzzxks3r0000gn/T/pip-install-hJvLr2/voluptuous/setup.py", line 6, in <module>
        version = __import__('voluptuous').__version__
      File "./voluptuous/__init__.py", line 3, in <module>
        from voluptuous.schema_builder import *
      File "./voluptuous/schema_builder.py", line 132
        def Self() -> None:
                   ^
    SyntaxError: invalid syntax
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I am well aware that Python 2.7 is no longer supported by the PSF, but we still need to support it in some of our projects for certain environments (including RedHat), and our builds currently break due to that.

The mitigation for us is to pin voluptuous on Python 2.7 to <0.14.0.

The vuluptuous project should do two things:

The question is, what is the minimum Python 3.x version now for version 0.14.0, is 3.6 sufficient?

andy-maier commented 11 months ago

PR #493 fixes this issue (assuming that Python 3.6 is the intended minimum Python version). Let me know if you want a higher version, then I can adjust the PR.

spacegaier commented 11 months ago

Resolved via https://github.com/alecthomas/voluptuous/pull/494