Python 2 Deprecation Plan: Say goodbye to python 2

Nov 16, 2020

By Amanda McGuinness of Ammeon Solutions

Python 2 reached end-of-life on 1st January 2020.  It served us for a long time, but today Python 2 pulls the project down as more packages drop python 2 support, making maintenance hard. Having to keep the codebase py2-compatible means we can’t take advantage of modern Python 3 features.  Removing Python 2 support and relying on Python 3 only is the required thing to do and now it’s finally time!

Stackstorm releases, including 3.3 still support python 2, but we intend to remove support in StackStorm 3.4. So start planning your migration!

In StackStorm 3.3 we have introduced python 2 deprecation warnings, for the following situations:

  • Installation of a pack where the python_versions listed is only python 2
  • Using st2ctl to start, restart or reload when running on a platform that uses python 2 (Ubuntu 16.04 or RedHat/CentOS 7)
  • In the log files of Stackstorm services running with python 2

What do I need to do?

Most importantly, check that the packs you have developed and the community packs you use support python3. If your personal packs do not, then please start migrating them to support python 3.  If community packs do not list python 3 as supported, then please consider helping to upgrade them to python 3. Please raise any issues found when running any packs on python 3.

Can I use python3 now?

Yes, you can. If you run StackStorm on our latest supported OS releases, they will automatically use python 3. Using a StackStorm installation on Ubuntu 18.04 or RedHat/CentOS 8 will automatically use python 3 for packs and the StackStorm services.

What if I have an older OS?

If you’re still on Ubuntu 16.04 LTS or CentOS/RHEL 7, you can still test packs work with python 3 on StackStorm releases that use python 2. Please see Python versions in Pack Python Virtual Environment for detailed instructions.

Once you are happy that your packs work, then you may want to consider upgrading to a newer OS release.

What version of python should I move to?

StackStorm currently uses python version 3.6 on its latest supported OS releases. We plan to add support for more python versions in the future.

What’s happening next?

Our current plans for python2 removal are:

  • StackStorm 3.4.0
    • CentOS/RHEL 7: Update installers to install python3.6 from OS repositories, and ST2 will run using python 3.6
    • Ubuntu 16.04: Add a prerequisite that python 3.6 is installed on the StackStorm machine’s using a PPA of the user’s choice. Installers will then use python 3.6, and ST2 will run using python 3.6
    • All packs will run with a python3 virtualenv, and so any packs that rely on python 2 code will need to be updated.
  • StackStorm 3.5.0
    • Ubuntu 20.04: Add support for Ubuntu 20.04 and Python 3.8
    • Ubuntu 16.04 support removed

Participation

To aid in the python 2 removal, we would welcome help from the community, please see the following related plans, and if you’d like to get involved comment on the issues or in our Slack Community:

We welcome and appreciate contributions of any kind (code, tests, documentation, examples, use cases, etc.). If you need help or get stuck at any point then at the Slack Community we will do our best to assist you.