Dave Hunt has recently landed a lot of great work to get some of our python unittests running with Python 3. You can see his blog post on it here: http://davehunt.co.uk/2018/06/29/python-unit-tests-now-running-with-python-3-at-mozilla.html
The march to Python 3 has been long and slow, but this is a major milestone along the way. It gives us more confidence that porting a module won't be immediately regressed again with the next change. Thanks Dave! I want to emphasize that the time is ripe to start porting any python modules you maintain to support Python 3 (in addition to 2). Here are some things you can do: 1) Enable the py2/py3 and flake8 linters on your module. You can do this by adjusting the include/exclude paths at the following locations: https://searchfox.org/mozilla-central/source/tools/lint/py2.yml https://searchfox.org/mozilla-central/source/tools/lint/py3.yml https://searchfox.org/mozilla-central/source/tools/lint/flake8.yml Then run |mach lint <path/to/module>| and fix any errors that show up (use --fix to automatically fix whatever it can). 2) Run your |mach python-test| tests under Python 3 in CI. The first step is to remove the 'skip-if' annotation from the relevant manifest: https://searchfox.org/mozilla-central/search?q=skip-if.*python+%3F%3D%3D+%3F3&case=true®exp=true&path=ini Next, run |mach python-test <path/to/module> --python 3| and fix any test failures that show up. Finally, adjust the task (if applicable) to run with both python 2 and 3 by modifying this line in the appropriate task: https://searchfox.org/mozilla-central/source/taskcluster/ci/source-test/python.yml#94 3) Write all new python code to be both Python 2 and Python 3 compatible. The 'six' library should be available in all contexts of mozilla-central (both locally and in CI). If it isn't, please file a bug. Here is a handy cheat sheet you can reference to solve incompatibilities: http://python-future.org/compatible_idioms.html 4) File bugs! Even if you don't have time to do the conversion now, get bugs on file and make them block the 'buildpython3' meta bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1388447 Having bugs like these on file can also turn into great first projects for a contributor. There is also infrastructure work we could implement to make the transition easier. For example, we should run the 'flake8' linter under python 3 as well as 2. We should also make |mach python-test| default to running tests with both. We'll only ever get to full python 3 compatibility if everyone buys in. While the end goal is still a long long way away, that shouldn't stop us from starting to make some progress now. Cheers, Andrew
_______________________________________________ dev-builds mailing list dev-builds@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-builds