Pin package in PyPI to block Python 2.7 users from upgrading to Rope version that's unsupported on it
Tasks:
- [ ] Make rope==1.x release as Python 3-only
- [ ] Make separate 0.x branch as a branch with last support for Python 2
- [ ] Update documentation to point Python 2 users to the 0.x branch
References:
According to jwodder from Stackoverflow:
There is a correct way to do this, but unfortunately pip only started supporting it in version 9.0.0 (released 2016-11-02), and so users with older versions of pip will continue to download packages willy-nilly regardless of what Python version they're for.
In your setup.py file, pass setup() a python_requires argument that lists your package's supported Python versions as a PEP 440 version specifier. For example, if your package is for Python 3+ only, write:
setup( ... python_requires='>=3', ... )If your package is for Python 3.3 and up but you're not willing to commit to Python 4 support yet, write:
setup( ... python_requires='~=3.3', ... )If your package is for Python 2.6, 2.7, and all versions of Python 3 starting with 3.3, write:
setup( ... python_requires='>=2.6, !=3.0.*, !=3.1.*, !=3.2.*, <4', ... )And so on.
Once you've done that, you will need to upgrade your version of setuptools to at least 24.2.0 in order for the python_requires argument to be processed; earlier versions will just ignore it with a warning. All of your project's sdists and wheels built afterwards will then contain the relevant metadata that tells PyPI to tell pip what Python versions they're for.