3 ms·
I'm happy this finally happened, even though I've been clinging to Python 2.7 for quite some time. I run a Flask course[0] and from the beginning I coded the a
by nickjj 7y ago
I'm happy this finally happened, even though I've been clinging to Python 2.7 for quite some time.
I run a Flask course[0] and from the beginning I coded the app to work for both 2.7.x and 3.x in parallel but it's only been a few months now where Celery supported Python 3.7.
In either case, upgrading from 2.7.x to 3.7.x was super painless. It came down to making sure Celery is using 4.3+ and pytest requires 5+ if you plan to use Python 3.5+. There wasn't any app level changes that had to be done other than optionally removing some dual import try/excepts to work for both 2.x and 3.x. The biggest pain point was remembering to use print with parenthesis but I've been doing that for a while now so it's a non-issue.
This was based on a decently sized Flask app with tens of top level dependencies and many thousands of lines of code.
If someone wants to see how this upgrade process looked in real time, I recorded that and put it up on Youtube[1] the other week. The video also covers some gotchas you might encounter during the upgrade process (especially if you're running in production and deal with sessions).
[0]: https://buildasaasappwithflask.com/ https://buildasaasappwithflask.com/
[1]: https://nickjanetakis.com/blog/upgrading-a-dockerized-flask-app-from-python-2-7-to-python-3-7 https://nickjanetakis.com/blog/upgrading-a-dockerized-flask-...
- guitarbill 7y agopytest has has python 3.5+ support for a while, even 4.0.0 supported it: https://pypi.org/project/pytest/4.0.0/ https://pypi.org/project/pytest/4.0.0/ . although the recent pytest changes are well worth picking up!
- nickjj 7y ago> pytest has has python 3.5+ support for a while, even 4.0.0 supported it: https://pypi.org/project/pytest/4.0.0/ https://pypi.org/project/pytest/4.0.0/ . although the recent pytest changes are well worth picking up! Yes but check the changelog for pytest. Version 5.x.x is only available for Python 3.5+. They dropped support for 2.7 and <= 3.4, unless you fall back to the 4.6 series.