{"id":3392,"date":"2020-06-08T13:23:32","date_gmt":"2020-06-08T11:23:32","guid":{"rendered":"http:\/\/blog.gocept.com\/?p=3392"},"modified":"2020-06-08T13:23:32","modified_gmt":"2020-06-08T11:23:32","slug":"we-have-nearly-one-million-lines-of-python-2-code-in-production-and-now","status":"publish","type":"post","link":"https:\/\/blog.gocept.com\/2020\/06\/08\/we-have-nearly-one-million-lines-of-python-2-code-in-production-and-now\/","title":{"rendered":"We have nearly one million lines of Python 2 code in production \u2013 and now?"},"content":{"rendered":"\n

Still running Python 2 code in production is like steering a ship without radar in thick fog: You don\u2019t know, which obstacle you will hit next. But there are ways to see the sun again even for large code bases.<\/p>\n\n\n\n

I am Michael Howitz and I am going to present a talk at Python Web Conf 2020 on this topic.<\/p>\n\n\n\n

In this talk I will show possible approaches for a Python 3 migration of existing Python code running on Python 2.7. I will evaluate which of these approaches seems suitable for a large code base and which principles should be paid attention to to increase the probability of a successful migration project.<\/p>\n\n\n\n

I am going use union.cms (a content management system used by German trade unions) to show the story of a successful migration of a project with nearly one million lines of Python code. The story will include the obstacles we encountered and what we learned on the way.<\/p>\n\n\n\n

I believe that most of the discussed ideas in the talk and experience can also be used unchanged in smaller projects as the presented principles are very much the same.<\/p>\n\n\n\n

The talk is scheduled at 1:00 \u2013 1:45 pm ET (UTC -4h) on Friday, June 19th. (That’s 7:00 pm in MEST (UTC+2)).<\/p>\n\n\n\n

To see the talk live on your device, join Python Web Conf 2020<\/a> now.<\/p>\n","protected":false},"excerpt":{"rendered":"

How to successfully migrate a Python 2 project to Python 3.<\/p>\n","protected":false},"author":15344399,"featured_media":3394,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_newsletter_tier_id":0,"footnotes":"","jetpack_publicize_message":"We have nearly one million lines of Python 2 code in production \u2013 and now? \u2014 How to successfully migrate a Python 2 project to Python 3. #Python #Migration #PythonWebConference","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[10221],"tags":[5784,1158,9402,832,5336674,739],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/blog.gocept.com\/wp-content\/uploads\/2020\/06\/michaelhowitz.jpg?fit=8533%2C4267&ssl=1","jetpack_likes_enabled":true,"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/pFP3y-SI","jetpack-related-posts":[{"id":3411,"url":"https:\/\/blog.gocept.com\/2020\/09\/03\/presentation-we-have-nearly-one-million-lines-of-python-2-code-in-production-and-now\/","url_meta":{"origin":3392,"position":0},"title":"Presentation: We have nearly one million lines of Python 2 code in production \u2014 and now?","author":"Michael Howitz","date":"September 3, 2020","format":false,"excerpt":"Still running Python 2 code in production is like steering a ship without radar in thick fog: You don\u2019t know, which obstacle you will hit next. But there are ways to see the sun again \u2013 even for large code bases. This presentation contains a discussion of the possible ways\u2026","rel":"","context":"In "en"","block_context":{"text":"en","link":"https:\/\/blog.gocept.com\/category\/en\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.gocept.com\/wp-content\/uploads\/2020\/08\/snake-601832_1280.jpg?fit=1200%2C636&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.gocept.com\/wp-content\/uploads\/2020\/08\/snake-601832_1280.jpg?fit=1200%2C636&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.gocept.com\/wp-content\/uploads\/2020\/08\/snake-601832_1280.jpg?fit=1200%2C636&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/blog.gocept.com\/wp-content\/uploads\/2020\/08\/snake-601832_1280.jpg?fit=1200%2C636&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/blog.gocept.com\/wp-content\/uploads\/2020\/08\/snake-601832_1280.jpg?fit=1200%2C636&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3350,"url":"https:\/\/blog.gocept.com\/2019\/11\/13\/union-cms-released-on-python-3\/","url_meta":{"origin":3392,"position":1},"title":"union.cms released on Python 3","author":"Michael Howitz","date":"November 13, 2019","format":false,"excerpt":"union.cms is a content management system which was once developed on Zope 2. It was one of the early adopters of the Five technology aka using Zope 3 components in Zope 2. Now it is one of the proud early adopters of Zope 4 on Python 3. It is used\u2026","rel":"","context":"In "en"","block_context":{"text":"en","link":"https:\/\/blog.gocept.com\/category\/en\/"},"img":{"alt_text":"Green tree python","src":"https:\/\/i0.wp.com\/blog.gocept.com\/wp-content\/uploads\/2019\/11\/green-tree-python-1312700.jpg?fit=1200%2C863&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.gocept.com\/wp-content\/uploads\/2019\/11\/green-tree-python-1312700.jpg?fit=1200%2C863&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.gocept.com\/wp-content\/uploads\/2019\/11\/green-tree-python-1312700.jpg?fit=1200%2C863&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/blog.gocept.com\/wp-content\/uploads\/2019\/11\/green-tree-python-1312700.jpg?fit=1200%2C863&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/blog.gocept.com\/wp-content\/uploads\/2019\/11\/green-tree-python-1312700.jpg?fit=1200%2C863&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":1540,"url":"https:\/\/blog.gocept.com\/2016\/09\/02\/zodb-py3migrate-1\/","url_meta":{"origin":3392,"position":2},"title":"zodb.py3migrate: Migrate an existing ZODB Data.fs to be used with Python 3","author":"Michael Howitz","date":"September 2, 2016","format":false,"excerpt":"At\u00a0Berlin Strategic sprint 2016\u00a0we\u00a0developed a tool to analyze a ZODB Filestorage to find\u00a0Python 2 string objects. If\u00a0they are in an encoding besides ASCII this is\u00a0preventing using this Filestorage with Python 3 because of decoding errors arising on loading the pickles. The tool is even able to convert those strings either\u2026","rel":"","context":"In "en"","block_context":{"text":"en","link":"https:\/\/blog.gocept.com\/category\/en\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2789,"url":"https:\/\/blog.gocept.com\/2017\/10\/25\/testing-zope-4beta2\/","url_meta":{"origin":3392,"position":3},"title":"Migrating from Zope 2.13 to 4.0b2","author":"Michael Howitz","date":"October 25, 2017","format":false,"excerpt":"Beta-Testing Zope 4 together with PerFact Innovation","rel":"","context":"In "en"","block_context":{"text":"en","link":"https:\/\/blog.gocept.com\/category\/en\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3229,"url":"https:\/\/blog.gocept.com\/2018\/06\/07\/migrate-a-zope-zodb-data-fs-to-python-3\/","url_meta":{"origin":3392,"position":4},"title":"Migrate a Zope ZODB Data.fs to Python 3","author":"Michael Howitz","date":"June 7, 2018","format":false,"excerpt":"TL;DR Use\u00a0zodbupdate. Problem A ZODB\u00a0Data.fs\u00a0which was created under Python 2 cannot be opened under Python 3. This is prevented by using a different magic code in the first bytes of the file. This is done on purpose because str\u00a0has a different meaning for the two Python versions: Under Python 2\u2026","rel":"","context":"In "en"","block_context":{"text":"en","link":"https:\/\/blog.gocept.com\/category\/en\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.gocept.com\/wp-content\/uploads\/2018\/06\/spring-3383890_1280.jpg?fit=1200%2C797&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.gocept.com\/wp-content\/uploads\/2018\/06\/spring-3383890_1280.jpg?fit=1200%2C797&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.gocept.com\/wp-content\/uploads\/2018\/06\/spring-3383890_1280.jpg?fit=1200%2C797&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/blog.gocept.com\/wp-content\/uploads\/2018\/06\/spring-3383890_1280.jpg?fit=1200%2C797&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/blog.gocept.com\/wp-content\/uploads\/2018\/06\/spring-3383890_1280.jpg?fit=1200%2C797&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":3225,"url":"https:\/\/blog.gocept.com\/2018\/05\/24\/zope-is-welcome-in-the-python-3-wonderland\/","url_meta":{"origin":3392,"position":5},"title":"Zope is welcome in the Python 3 wonderland!","author":"Michael Howitz","date":"May 24, 2018","format":false,"excerpt":"Earl Zope already got the beta permission to stay in the Python 3 wonderland some months ago. His current objective is to help old friends to come to the Python 3 wonderland and to make new friends. He has to build trust in his will and ability to stay in\u2026","rel":"","context":"In "en"","block_context":{"text":"en","link":"https:\/\/blog.gocept.com\/category\/en\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/blog.gocept.com\/wp-content\/uploads\/2018\/05\/zope-4-welcome-sprint.jpg?fit=1200%2C637&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/blog.gocept.com\/wp-content\/uploads\/2018\/05\/zope-4-welcome-sprint.jpg?fit=1200%2C637&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/blog.gocept.com\/wp-content\/uploads\/2018\/05\/zope-4-welcome-sprint.jpg?fit=1200%2C637&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/blog.gocept.com\/wp-content\/uploads\/2018\/05\/zope-4-welcome-sprint.jpg?fit=1200%2C637&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/blog.gocept.com\/wp-content\/uploads\/2018\/05\/zope-4-welcome-sprint.jpg?fit=1200%2C637&ssl=1&resize=1050%2C600 3x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/blog.gocept.com\/wp-json\/wp\/v2\/posts\/3392"}],"collection":[{"href":"https:\/\/blog.gocept.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.gocept.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.gocept.com\/wp-json\/wp\/v2\/users\/15344399"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.gocept.com\/wp-json\/wp\/v2\/comments?post=3392"}],"version-history":[{"count":3,"href":"https:\/\/blog.gocept.com\/wp-json\/wp\/v2\/posts\/3392\/revisions"}],"predecessor-version":[{"id":3396,"href":"https:\/\/blog.gocept.com\/wp-json\/wp\/v2\/posts\/3392\/revisions\/3396"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.gocept.com\/wp-json\/wp\/v2\/media\/3394"}],"wp:attachment":[{"href":"https:\/\/blog.gocept.com\/wp-json\/wp\/v2\/media?parent=3392"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.gocept.com\/wp-json\/wp\/v2\/categories?post=3392"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.gocept.com\/wp-json\/wp\/v2\/tags?post=3392"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}