Skip to content

Python 2 to Python 3 transition

blag edited this page Apr 13, 2020 · 5 revisions

Overview

This page details information about transforming StackStorm from using Python 2 to Python 3

Modernize StackStorm Code

Find code to modernize

python3.6 -m modernize -x libmodernize.fixes.fix_print st2common/

If you pip install pigments you can pipe the output of modernize through pygments -l diff

python3.6 -m modernize -x libmodernize.fixes.fix_print st2common/ | pygmentize -l diff

Modernize the code

Then if you're happy add -w -n it will write the changes (without a backup, since we're using git).

python3.6 -m modernize -x libmodernize.fixes.fix_print st2common/ -w -n

Modernize Libraries

Use these tools to find dependencies that don't support Python 3:

TODO List

  • Unit tests for Python 3 along side Python 2
  • Python 3 packaging (how are we going to install Python 3)
  • Packs (this should probably be its own TODO list) - (almost) done