smp: Simple Management Protocol

raw JSON →
4.0.2 verified Fri May 01 auth: no python

smp is a Python implementation of the Simple Management Protocol (SMP) for remotely managing MCU firmware, commonly used with Zephyr and MCUboot. Version 4.0.2 is current, supporting Python >=3.9. The library provides client and server functionality for MCU management including image upload, shell, file system, and task statistics. Releases occur every few months.

pip install smp
error ModuleNotFoundError: No module named 'smp.client'
cause Import path changed in v4.0.0.
fix
Use 'from smp import SMPClient' instead.
error ValueError: Fragment size 8192 exceeds maximum 127
cause Default fragment size reduced to 127 in v4.0.0. An explicit large value is rejected.
fix
Set fragment_size to a value <= 127 or use the default.
error TypeError: object NoneType can't be used in 'await' expression
cause Trying to await a synchronous method or missing client.connect() call.
fix
Ensure you call 'await client.connect()' before other operations.
error smp.exceptions.SMPError: No response received
cause MCU not reachable or wrong transport address.
fix
Verify the MCU is running and the port is correct; check network connectivity.
breaking v4.0.0 dropped Python 3.8 support. Upgrade to Python >=3.9.
fix Ensure Python 3.9+ is installed.
breaking v4.0.0 changed default line length from 8192 to 127 bytes for encode(). Override if using larger frames.
fix Use `SMPClient.encode(data, fragment_size=8192)` if 8192 bytes is required.
gotcha Top-level imports changed in v4; 'from smp.client import SMPClient' no longer works.
fix Use 'from smp import SMPClient' instead.
deprecated The 'session' module is deprecated in favor of the new client interface.
fix Migrate to SMPClient (import from smp).

Connect to a remote MCU over TCP, send an echo request, and list management groups.

import asyncio
from smp import SMPClient, Group

async def main():
    client = SMPClient("tcp://localhost:6500")
    await client.connect()
    # Get echo response
    echo = await client.echo(data=b"hello")
    print("Echo:", echo)
    # List groups
    groups = await client.get_group_list()
    print("Groups:", groups)
    await client.disconnect()

asyncio.run(main())