How-to: Migrate Your Development Environment to Python 3.7

During the Python 3.7 migration, we made several changes in the project tooling. These changes requires you to set up a new Python environment. This how-to will guide you through the process.

  1. Install Python 3.7 if you don’t have it already. 3.7.3 or later is recommended, because 3.7.3 contains several fixes related to multiprocessing. It is recommended to set 3.7 as your default Python version.

    Checking your Python version:

    python -V
    
  2. Pipenv is no longer used to manage dependencies, the project was migrated to Poetry, a more recent and faster alternative. Install it by following the official install guide.

    Version 1.1.2 or later is recommended, because previous versions contains various bugs.

    You can check your current version:

    poetry -V
    

    The version to install can be specified py passing --version 1.1.2 to the Poetry installer.

  3. Install Python dependencies:

    poetry install
    
  4. Update the interpreter settings in your IDE to use the new virtual environment. You can find the full path to the virtualenv managed by Poetry by running the following command:

    poetry env info -p
    

    In PyCharm, you can install the Poetry plugin. This plugin will offer you the existing Poetry virtualenv when setting the new interpreter.

    The environment can be set in Settings > Project: ppc-robot > Project Interpreter. Click the settings icon in the top-right corner, select Add and either Virtualenv Environment, or Poetry Environment.

  5. Some of the libraries used in the project were updated, so you have to run migrations:

    poetry run ppc_robot migrate
    

Activating the virtualenv

You can activate the virtualenv by running the following command:

poetry shell

If you want to run a single command with the virtualenv active, prefix it with poetry run, e.g.:

poetry run ppc_robot migrate