RequirementsPython version and platform

RequirementValue
Python3.8 or newer
Platforms with a prebuilt wheelLinux (glibc / manylinux), macOS, Windows x64
Rust toolchainnot needed
Other Python packagesnone

musl Linux and 32-bit Windows have no wheel: pip builds from source and needs a Rust toolchain (see Build & features).

VerifyPrint the version

If the version prints, the library loaded. Next: first program.

python -c "import medius; print(medius.version_string(), 'abi', medius.abi_version())"
# 3.4.6 abi 10

An OSError on import means the library didn't load: an unsupported platform, or a bad MEDIUS_LIB path. See how the library is found.

An ImportError naming two ABI numbers means library and package come from different releases: install the matching package, or point MEDIUS_LIB at a library from the same release.

ConnectOpen a box, read its version

Device.find() opens the first box it finds and runs the handshake; the with block closes the link on exit.

from medius import Device

with Device.find() as dev:
    v = dev.query_version()
    print(f"firmware {v.fw_major}.{v.fw_minor}.{v.fw_patch}, proto {v.proto_ver}")

With no port, find() raises NotFoundError. Pass a path with Device.open("/dev/ttyACM0") (Windows: "COM3"), or list ports with medius.find_ports(). Errors: Calls & errors.