Install
Install with pip; no compile step:
pip install mediusThe Bindings overview shows how the package, the C ABI and the Rust medius crate relate.
RequirementsPython version and platform
| Requirement | Value |
|---|---|
| Python | 3.8 or newer |
| Platforms with a prebuilt wheel | Linux (glibc / manylinux), macOS, Windows x64 |
| Rust toolchain | not needed |
| Other Python packages | none |
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 10An 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.