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.
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
cd <path_to_place_venv>
<venv_name>\Scripts\activate
pip install typhoontest==<version>
typhoon-python -m pip show typhoontest
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:
- 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.