The document summarizes a company's plan to migrate their monolithic Python application from Python 2.7 to Python 3. It discusses setting up the code to be Python 3 compatible, making it run on test environments, passing all tests, upgrading database migrations, manually testing, releasing the new version, and rolling back when issues were discovered after release. It ends by thanking the audience.
3. The Status Quo
● One monolith running Python 2.7
● 7 years old codebase
● MySQL, Django, Celery, Redis
● 38M users all around the world
4. The Plan
● Make the code Python 3 compatible
● Have it run on our test environments for a while
● Do a round of manual testing
● Ship it
5. I. Set it up
● Not all of our dependencies were Python 3 compatible
● Suds
● Add tests to mock the calls
● Replace it with zeep
● Verify
6. II. Make it run
● Failing imports
● Local imports
● Six
○ Moved libs
○ six.iteritems
○ Six.text_type
● Setup CircleCI to test both 2.7 and 3.6
7. III. Make tests pass
● six.iteritems
● six.text_type
● hashlib requires bytes
● exception.message
● xrange
● dict_keys
● filter
● Comparing with None
● round behaving differently
8. IV. Upgrade migrations & Manual test
● Custom column names existed as bytes in migrations
● Same for choices and help_text
● Some third party apps generated new migrations
● Manual tests
12. VI. Rollback and aftermath
● Sentry could not handle the error load
● Redis is an issue
○ Via Django
○ Direct usage
● Python 3 incompatible code not covered by tests
● filter
● Lesson learned - Monday morning == Friday evening
Six - fixes moved modules compatibility
Local import - In Python 3 you need to explicitly specify if you want module or package level import.
We also had print statements