Brotli 1.1.0 breaks Python 2 compatibility
- Dominant language
- TypeScript
- Stars
- 14.9k
- Forks
- 1.4k
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 9
Description
The latest release of Brotli breaks compatibility with Python 2, due to using `f`-strings in the `setup.py`:
```bash
> python --version
Python 2.7.18
> pip install brotli
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Collecting brotli
Downloading Brotli-1.1.0.tar.gz (7.4 MB)
|████████████████████████████████| 7.4 MB 3.9 MB/s
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Command errored out with exit status 1:
command: /Users/jean/Desktop/venv2/bin/python /Users/jean/Desktop/venv2/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /var/folders/3q/mfpgkgl960xcdx3y00zd46hm0000gp/T/tmpYNqwFZ
cwd: /private/var/folders/3q/mfpgkgl960xcdx3y00zd46hm0000gp/T/pip-install-N9sWxP/brotli
Complete output (17 lines):
Traceback (most recent call last):
File "/Users/jean/Desktop/venv2/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in
main()
File "/Users/jean/Desktop/venv2/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Users/jean/Desktop/venv2/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py", line 114, in get_requires_for_build_wheel
return hook(config_settings)
File "/private/var/folders/3q/mfpgkgl960xcdx3y00zd46hm0000gp/T/pip-build-env-1DHL2I/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 146, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
File "/private/var/folders/3q/mfpgkgl960xcdx3y00zd46hm0000gp/T/pip-build-env-1DHL2I/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 127, in _get_build_requires
self.run_setup()
File "/private/var/folders/3q/mfpgkgl960xcdx3y00zd46hm0000gp/T/pip-build-env-1DHL2I/overlay/lib/python2.7/site-packages/setuptools/build_meta.py", line 142, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 30
m = re.match(rf'#define\s{macro}\s+(.+)', line)
^
SyntaxError: invalid syntax
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/jean/Desktop/venv2/bin/python /Users/jean/Desktop/venv2/lib/python2.7/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /var/folders/3q/mfpgkgl960xcdx3y00zd46hm0000gp/T/tmpYNqwFZ Check the logs for full command output.
```
I'm not sure of the correct way to solve the issue:
- If the decision is to keep the compatibility, I can confirm that removing the two `f`-strings fixes the issue and that the package can then be installed with Python 2.
- Otherwise, it would be nice if the Python 2 classifiers were removed and if the `python_requires` field was used to specify that the package needs at least Python 3.6+.
Contributor guide
Assessment
This issue has not been assessed yet.