Readit News logoReadit News
sarahboyce · 2 years ago
30% of Django developers upgrade every LTS release[1]. As Django 3.2 runs out of support in April this year[2], it's worth celebrating Adam Johnson's package django-upgrade (https://github.com/adamchainz/django-upgrade) which has a set of fixers to automatically update your Django code to the version of your choice.

Curious if anyone has used 2to3 (https://docs.python.org/3/library/2to3.html) for upgrading Python code and can share their experience with it? Would you recommend?

1. https://lp.jetbrains.com/django-developer-survey-2022/

2. https://www.djangoproject.com/download/#supported-versions

apothegm · 2 years ago
2to3 is good and will get you 80% of the way there. You’re on your own for the last 20%. Decent test coverage will take care of most of the rest. It’s definitely time to be off Python 2.

Never used Django-upgrade. The release notes are excellent and backwards incompatibilities usually fairly minimal anyway. Incremental upgrades through intermediate versions can be worthwhile nonetheless if you’re jumping more than 1 version.