-
Notifications
You must be signed in to change notification settings - Fork 6
Remove Python 2 support
Michael Howitz edited this page Feb 11, 2020
·
10 revisions
-
pyupgradeinstalled (the code examples below expect it to be on the search PATH.)
The following steps are necessary to remove Python 2 support from a package:
- setup.py
- Update version number to next major version.
- Remove Python 2 from the list of classifiers.
- Remove
sixfrom the list of dependencies - Update
python_requirestopython_requires='>=3.4, <4', - Remove other things pointing to Python 2 or PyPy[2].
- tox.ini
- Remove
py27andpypyfrom `envlist - Remove Python 2 specific environments
- Remove
- CHANGES.rst
- Update the version number of the unreleased version
- Add an entry:
Drop support for Python 2.
- pyupgrade
- Run
find src -name "*.py" -exec pyupgrade --py3-only {} \;- It updates the code to Python 3 e. g. by removing (some of)
sixusage
- It updates the code to Python 3 e. g. by removing (some of)
- Run
grep -rn six src- Remove or change all the usages of
six
- Remove or change all the usages of
- Run