Skip to content

Instantly share code, notes, and snippets.

@jrief
Last active February 2, 2021 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrief/0e6b97be132452a511eae81d54ca01ae to your computer and use it in GitHub Desktop.
Save jrief/0e6b97be132452a511eae81d54ca01ae to your computer and use it in GitHub Desktop.
Checklist for dropping Python-2 support
* Remove all occurences of `# -*- coding: utf-8 -*-`.
* Remove all imports `unicode_literals`.
* Search for all occurences of `super(MyClass, self).` and replace by `super()`. **Check for grandparent super()!**.
* Search for all occurences of `six` and remove compatibility checks.
* Replace `ugettext` by `gettext`.
* Search for all occurences of `@python_2_unicode_compatible` and remove it.
* Search for all occurences of `__unicode__` and replace by `__str__`.
* Search for all occurences of `__nonzero__` and replace by `__bool__`
* Replace `from django.conf.urls import url` by `from django.urls import re_path`.
* Remove inheritance from `...(object)`.
* Replace `from django.forms.fields import EMPTY_VALUES` against `from django.core.validators import EMPTY_VALUES`.
* Replace all occurences of `force_text` by `force_str`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment