Install & Setup
The Infuse-IoT Python Tools can be installed on:
- Windows (Natively or using WSL - Windows Subsystem for Linux).
Instructions for WSL falls under Ubuntu and bash categories below.
- Ubuntu + other Linux Distros.
- macOS.
Prerequisites
Install Python
Ensure a suitable version of Python is installed on your system. The Python Tools are tested with Python versions 3.10 through to 3.14. Checking if Python is installed (and which version) can be done by running the following in your terminal.
python --version
sudo apt install python3-dev
Avoid using macOS's built-in Python for development, as it is managed by the operating system and used by system tools. Installing a separate Python version helps avoids conflicts, and keeps your development environment isolated.
Install Homebrew
If you don't already have Homebrew, you can install it by following Homebrew's installation instructions.
Install Python using Homebrew
brew install python3
Windows has many ways in which Python can be installed:
- The Microsoft Store's Python 3.12
- Windows' preinstalled package manager winget
(on Windows 11 and recent Windows 10 systems).
wingetinstallation can be verified by runningwinget --versionin the terminal. If it's missing, you can install winget first.winget install Python.Python.3.12 - The Python Homepage Downloads
Do you need a Virtual Environment
Python now requires virtual environments to avoid package conflicts.
The next steps depends on whether you:
- Already have your own virtual environment (or one using a different environment manager) for Infuse-IoT Python Tools, or intend to use the same virtual environment created as part of an existing ZephyrRTOS or Infuse-IoT SDK installation.
- Don't have one (or know if you have one), but plan to install the Infuse-IoT embedded SDK, or
- Plan to use Infuse-IoT Python tools standalone (without the Infuse-IoT embedded SDK installed).
Skip to Installation.
The easiest way to setup the venv is to install the Infuse-IoT Embedded SDK. Follow the Infuse-IoT Embedded SDK Getting Started Guide to install the embedded SDK, and then continue to Installation.
The easiest method to install the Python Tools is to use pipx (instead of pip).
pipx.
Instead ignore this step and skip to Setup a Virtual Environment (.venv)Run the following to install pipx depending on your OS.
sudo apt install pipx
Or follow the instructions in the pipx documentation
Follow the instructions in the pipx documentation
Follow the instructions in the pipx documentation
Once pipx is installed, continue to Installation,
noting to substitute pip with pipx.
Setup a Virtual Environment (.venv)
Zephyr's Getting Started Guide
outlines the process to setup a virtual environment in zephyrproject (in your user profile/home directory).
Follow the instructions to setup a Virtual Environment.
Don't forget to activate your environment
Remember to activate your virtual environment every time your start a new terminal before working with Infuse-IoT Python Tools, or it won't function. With the default installation path, this can be done by running:
source ~/zephyrproject/.venv/bin/activate
.zshrc/.bashrc to automatically launch the virtual environment when opening a shell to avoid needing to
type it each time. Otherwise using an alias can make it easier to switch between different venv's.zephyrproject\.venv\Scripts\Activate.bat
zephyrproject\.venv\Scripts\Activate.ps1
Installation
The Python tools can be installed from PyPI.
Utilise the following command to install Infuse-IoT Python Tools.
pip install infuse-iot
pipx install infuse-iot
Once installed, some additional setup required.
Additional Setup
Keyring
Infuse-IoT Python Tools utilises Keyring to securely store secrets such as API keys and caching Network Credentials and installs it as part of Infuse-IoT's installation. Keyring is cross platform by utilising different backends on different OS's.
Check that Keyring is correctly setup by running:
keyring --list-backends
This will output the supported backends on your machine such as:
> keyring --list-backends
keyring.backends.chainer.ChainerBackend (priority: -1)
keyring.backends.fail.Keyring (priority: 0)
keyring.backends.SecretService.Keyring (priority: 5)
Search for a backend with a priority above 0.
Ubuntu and other distros won't always have a default credential provider. The preferred predential storage provider is provided by gnome-keyring and appears as:
keyring.backends.SecretService.Keyring.
It can be installed with:
sudo apt install gnome-keyring
Apple's Keychain is the preferred credential storage provider and is preinstalled. It appears as:
keyring.backends.macOS.Keyring.
Windows Credential Locker is the preferred credential storage provider and is preinstalled. It appears as:
keyring.backends.Windows.WinVaultKeyring.
Setup Infuse-IoT Credentials
The Python tools interract with the Infuse-IoT cloud API to setup boards and run cloud RPCs. To perform these tasks, the Python tools require a Cloud API key to authorise the commands.
At this point in time the Infuse-IoT Cloud API only accepts legacy Organisation Admin API Keys (opposed to other Temporary and IAM Managed API Keys that are also available in the Infuse-IoT Portal). The Legacy Organisation Admin API key can be retrieved by Organisation Admins from the Infuse-IoT Portal Under the Admin Centre > Developer at the very bottom under the "Infuse Iot Admin Api Key" section. Click the "Fetch Key" button and copy the API Key.
Run the command below (replacing [API_KEY] with your API key, while ommitting the Bearer prefix)
to save your API key on the machine.
infuse credentials --api-key [API_KEY]
secretstorage.exceptions.PromptDismissedException: Prompt dismissed
.bashrc if it reappears after rebooting WSL)dbus-update-activation-environment --systemd DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY
When launching infuse it will attempt to unlock the keyring to access its credentials,
and you will receive a password prompt.
Register Autocomplete (Optional)
Enable Tab auto completion for the Python Tools.
Add the following to your .bashrc
eval "$(register-python-argcomplete infuse)"
.bashrc,
ensure to add this line afterwards.Add the following to your .zshrc.
autoload -Uz compinit
compinit
eval "$(register-python-argcomplete infuse)"
.zshrc,
ensure to add this line afterwardsTab Autocomplete is not supported on Windows terminals.
Cache Network Credentials (Optional)
During development, Infuse-IoT SDK powered devices utilise a default, publicly available network key for encryption.
A custom, non-public network key may be used during development and should be used for releases.
For the Python tools to communicate with these devices, the encryption key must be registered with the Python Tools.
These custom keys are generated by the embedded SDK as a .yamlfile and can be shared and imported into the Python
tools with:
infuse credentials --network network_key_file.yaml
Load Project Specific Definitions & Scripts (Optional)
If you're using a custom project that includes custom definitions (for RPCs, TDFs, KV, etc), you can import those into the Python tools.
Import custom tools:
python credentials --custom-tools /path/to/tools_folder
scripts/tools folderImport custom definitions:
python credentials --custom-definitions /path/to/definitions_folder
generated folder