cms icon indicating copy to clipboard operation
cms copied to clipboard

Drop support for Python 2

Open lw opened this issue 7 years ago • 0 comments

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).

  • [x] Change the shebang to explicitly refer to python3
  • [x] Remove the # -*- coding: utf-8 -*- line
  • [x] Remove __future__, future and six imports (and replace their usages appropriately, e.g., use dict.foo() instead of iterfoo(dict), self.assertBar(...) instead of six.assertBar(self, ...), ...)
  • [x] Remove leftover explicit unicode literals (i.e., the u"foo")
  • [x] Replace all usages of io.open with just open
  • [x] Replace IOError and EnvironmentError with OSError as they are now the same
  • [x] Use the most appropriate subclasses of OSError (e.g., FileNotFoundError) instead of checking the errno of the exception
  • [x] Import from unittest.mock rather than from mock (and remove mock from the dev-requirements)
  • [ ] Use the TestCase's assertLogs method instead of mocking loggers
  • [x] Update the setup.py, .travis.yml, the doc, the website, etc.
  • [x] Use the 1_000_000 syntax for big numerical constants (replace 1000000 and 1000 * 1000)
  • [x] Look for the strings py2, py3, Python 2, etc. in the code that we used to annotate specific issues
  • [x] Clean up the monotonic clock in cmscommon.datetime
  • [x] Use subprocess.DEVNULL where applicable
  • [x] Refactor rmtree to make it immune to symlink attacks
  • [ ] Use type annotations!
  • [x] Use shlex.quote
  • [x] Remove ipaddress from the requirements
  • [x] 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).
  • [x] Don't have classes extend object explicitly.

Feel free to add to this list.

lw avatar May 02 '18 09:05 lw