Drop support for Python 2
Open
@lw is already working on this.
Since May 2, 2018.
- Dominant language
- Python
- Stars
- 1k
- Forks
- 412
- Avg merge
- 6d 10h
- Merged PRs (30d)
- 3
Description
Despite the alluring title, this is just a tracking issue listing things to do to the code when we will drop support for Python 2 (which won't happen before the next release).
- Change the shebang to explicitly refer to
python3 - Remove the
# -*- coding: utf-8 -*-line - Remove
__future__,futureandsiximports (and replace their usages appropriately, e.g., usedict.foo()instead ofiterfoo(dict),self.assertBar(...)instead ofsix.assertBar(self, ...), ...) - Remove leftover explicit unicode literals (i.e., the
u"foo") - Replace all usages of
io.openwith justopen - Replace
IOErrorandEnvironmentErrorwithOSErroras they are now the same - Use the most appropriate subclasses of
OSError(e.g.,FileNotFoundError) instead of checking theerrnoof the exception - Import from
unittest.mockrather than frommock(and removemockfrom thedev-requirements) - Use the
TestCase'sassertLogsmethod instead of mocking loggers - Update the
setup.py,.travis.yml, the doc, the website, etc. - Use the
1_000_000syntax for big numerical constants (replace1000000and1000 * 1000) - Look for the strings
py2,py3,Python 2, etc. in the code that we used to annotate specific issues - Clean up the monotonic clock in
cmscommon.datetime - Use
subprocess.DEVNULLwhere applicable - Refactor
rmtreeto make it immune to symlink attacks - Use type annotations!
- Use
shlex.quote - Remove
ipaddressfrom the requirements - Check uses of
str(...)that are no-ops in py3 but were used to convert py2-str to py2-unicode when they contained only ASCII (because some libraries return unicode only when it is non-ASCII, and str otherwise). - Don't have classes extend
objectexplicitly.
Feel free to add to this list.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.