tantale / deprecated

Python @deprecated decorator to deprecate old python classes, functions or methods.
MIT License
298 stars 32 forks source link

The dependent `wrapt` package no longer supports Python 2.7 on Windows #49

Closed ddanilko-sonova closed 2 years ago

ddanilko-sonova commented 2 years ago

Problem statement

According to https://github.com/tantale/deprecated/blob/f5eebcddaebf2dafd3f734e85c4c85cbbae9aef4/setup.py#L161 the deprecated package depends on the wrapt package (most recent 1.*-compatible version).

Unfortunately, the wrapt package does not follow semantic versioning which means that the installation of the deprecated package might fail if a new 1.* release of the wrapt package comes out. This is what happened recently with the release of version 1.13.0 of wrapt not being able to install on Windows+Python2.7. For details refer to https://github.com/GrahamDumpleton/wrapt/issues/189. Unfortunately, the developers of wrapt do not plan to adhere to semantic versioning, which means that for deprecated to work reliably for its users, it might be a good idea to adapt the version specification of the wrapt package.

Possible solution

First, pin the version of wrapt to ==1.12.1 and release deprecated as 1.2.14 Then pin the version of wrapt to ==1.13.1 and release deprecated as 2.0.0, stating that the support for Python2.7 on Windows is dropped or drop support for Python 2.7 on all platforms (as it might be difficult to specify the combination with Windows in the setup scripts...)

Alternatives considered

After releasing deprecated v1.2.14 with wrapt==1.12.1, one could consider unpinning wrapt again (wrapt<2), however, given that wrapt does not adhere to semantic versioning, this should be considered dangerous (e.g. they consider dropping support for Python2.7 in 1.14.0).

Reproduction steps

Make sure that you do not have wrapt installed. Install deprecated on Windows+Python2.7

python -m pip install deprecated=1.2.13

Expected Behavior

The installation succeeds.

Actual Behavior

The installation fails with the following error:

Collecting wrapt<2,>=1.10
  Using cached wrapt-1.13.1.tar.gz (48 kB)
Using legacy 'setup.py install' for wrapt, since package 'wheel' is not installed.
Installing collected packages: wrapt
    Running setup.py install for wrapt ... error
    ERROR: Command errored out with exit status 1:
     command: 'C:\Python27\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\\users\\361dda~1\\appdata\\local\\temp\\pip-install-9vpyu6\\wrapt\\setup.py'"'"'; __file__='"'"'c:\\users\\361dda~1\\appdata\\local\\temp\\pip-install-9vpyu6\\wrapt\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'c:\users\361dda~1\appdata\local\temp\pip-record-zbb4wg\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Python27\Include\wrapt'
         cwd: c:\users\361dda~1\appdata\local\temp\pip-install-9vpyu6\wrapt\
    Complete output (15 lines):
    C:\Python27\lib\distutils\extension.py:133: UserWarning: Unknown Extension options: 'optional'
      warnings.warn(msg)
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-2.7
    creating build\lib.win-amd64-2.7\wrapt
    copying src\wrapt\decorators.py -> build\lib.win-amd64-2.7\wrapt
    copying src\wrapt\importer.py -> build\lib.win-amd64-2.7\wrapt
    copying src\wrapt\wrappers.py -> build\lib.win-amd64-2.7\wrapt
    copying src\wrapt\__init__.py -> build\lib.win-amd64-2.7\wrapt
    running build_ext
    building 'wrapt._wrappers' extension
    error: Microsoft Visual C++ 9.0 is required. Get it from http://aka.ms/vcpython27
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Python27\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'c:\\users\\361dda~1\\appdata\\local\\temp\\pip-install-9vpyu6\\wrapt\\setup.py'"'"'; __file__='"'"'c:\\users\\361dda~1\\appdata\\local\\temp\\pip-install-9vpyu6\\wrapt\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'c:\users\361dda~1\appdata\local\temp\pip-record-zbb4wg\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Python27\Include\wrapt' Check the logs for full command output.

Environment

tantale commented 2 years ago

No, you are wrong, this is not an incompatible change. Graham Dumpleton is very meticulous and would not allow himself this kind of mistake.

The real problem is that there is no wheel available for Python 2.7 on Windows (but there are some for Python >= 3.5). He says that this is due to a compilation issue with GitHub Action.

2 solutions:

Sorry, but I won't accept the PR.