Firefox/Python 3 Migration

From MozillaWiki
< Firefox
Revision as of 17:49, 30 May 2019 by Catlee (talk | contribs) (→‎How to Port the Code: Initial porting guide)
Jump to navigation Jump to search

Why This is Important

In mozilla-central there are over 3500 Python files (excluding third party files), comprising roughly 230k lines of code. Most of it is Python 2.[1]

Python 2 will reach it's End Of Life on January 1st 2020. This page collects links and resources to assist the migration of the Firefox ecosystem off of Python 2 and onto Python 3.

Getting Involved

Find the others

Most discussion happens in the #python channel on Slack (NDA'd Mozillians only).

Find a place to start hacking

Bug 1496527 tracks the migration work across Firefox.

How to Port the Code

  • Make sure you can test the code you're working on with python3!
    • If using `tox`, then adding `py35`, and `py36` to the list of environments should be sufficient
  • `futurize`` can be used to transform code into code that's compatible with both python2.7 and python3
  • The `six` module is available in-tree, feel free to use it as a dependency

References

https://ahal.ca/blog/2019/python-3-at-mozilla

Python 3 tree migration notes