Python Interpreters

Overview of how you can use Typhoon HIL Python Interpreters to further customize your test files.

Each Typhoon HIL Control Center installation includes two different Python Interpreters:

  • Frozen Python which is used by HIL SCADA and Schematic Editor;
  • typhoon-python which is used by TyphoonTest IDE.

Frozen Python has the same version as typhoon-python and, as the name suggests, is immutable. Packages cannot be installed, upgraded, or even removed directly on it.

The typhoon-python is mutable, so packages can be removed, installed and upgraded there.

The typhoon-python Interpreter

You can use typhoon-python in any system directory as soon as Typhoon HIL Control Center is installed and opened for the first time. The command typhoon-python executes a Python Interpreter and using the following commandsin this section, packages can be installed and the test framework can be used.

Note: The typhoon-python command is available only on Windows.
To install packages, you can type in the windows Command Prompt:
 typhoon-python -m pip install <name_of_package>

Available packages can be searched and checked on the PyPI website.

To create a new environment (venv) that can be used on TyphoonTest IDE as a Custom Python Interpreter you can:

 typhoon-python -m virtualenv <path_to_place_venv>\<venv_name>

To use this path you just need to enter in the dialog that opens when you select “Custom”:

 <path_to_place_venv>\<venv_name>\Scripts\python.exe
Note: In order to make it work make sure you have typhoontest API installed in your custom Python Interpreter. First, activate your environment with the Command Prompt.
cd <path_to_place_venv>
<venv_name>\Scripts\activate
Then, install typhoontest API that matches Typhoon HIL Control Center version:
 pip install typhoontest==<version>
Check the typhoontest API version using:
typhoon-python -m pip show typhoontest
The typhoon-python interpreter can be used also to execute pytest tests:
typhoon-python -m pytest [options] <test_folder>

More about pytest options can be checked in our typhoontest API Documentation in Documentation Hub and on pytest framework webpage.

To restore the typhoon-python interpreter you need to:

Note: This should be considered as a measure of last resort, bringing unintended consequences for your installation. Use with caution!
  • Close Typhoon HIL Control Center
  • Delete the folder “%APPDATA%\typhoon\<THCC_VERSION>”
  • Reopen Typhoon HIL Control Center

After that you should be able to see the folder once again and the typhoon-python interpreter will have the default packages and versions.

More than one THCC installed

If more than one Typhoon HIL Control Center version is installed you can check which folders the command typhoon-python can be located typing on Command Prompt:

where typhoon-python

If you have more than one Typhoon HIL Control Center installed, one will be printed for each. The first one in the list will be the one used when invoking typhoon-python. To change which version will be used by typhoon-python:

  • Go to the “Edit Environment Variables” on Windows
  • Select “Environment Variables …”

  • Search for Path on System Variables and press Edit... or a double-click

  • Then select and Move Up the desired Typhoon HIL Control Center version to the first position of the list

  • Reopen Command Prompt and check again with “where typhoon-python” command. The version shown needs to be the same as the one select on Path.