crumbs-i2c
CRUMBS for Python: the frame, its CRC, and a controller that talks to CRUMBS peripherals over Linux I2C. Pure Python, no dependencies, Python 3.11 or newer.
pip install crumbs-i2c
from crumbs_i2c import Controller, LinuxBus, Message
with LinuxBus("/dev/i2c-1") as bus:
crumbs = Controller(bus)
# A SET: one frame written, nothing read back.
crumbs.send(0x10, Message(type_id=0x01, opcode=0x02, data=b"\x01"))
# A GET: SET_REPLY names the reply, then it is read and checked.
reply = crumbs.query(0x10, type_id=0x01, opcode=0x80)
print(reply.data)
# Every address in 0x08-0x77 that answers with a CRUMBS frame, by type.
print(crumbs.scan())
The payload is opaque here: a device family's encoders and parsers, such as
bread-crumbs-contracts,
build and read data.
What it does
-
encode,decodeandframe_lengthfollow the C library exactly; the tests check them against vectors the C code writes (tests/golden_vectors/). -
Controller.querysends SET_REPLY with the wildcard type, waits 10 ms as the C getters do, reads a full 31-byte frame, trims it to the length its header declares, and checks the reply's opcode and type. A GET is safe to repeat, so the whole exchange is tried again, up to three times in all, when:- the reply is corrupt (a Raspberry Pi's I2C controller ignores clock
stretching, so a reply the peripheral is still building can read as
0xFFbytes); - it is the same device's reply to another opcode (a lost SET_REPLY, or a device that restarted);
- the device did not answer (
ENXIO,EREMOTEIO,EIO,ETIMEDOUT,EAGAIN).
Another device type at the address raises
ReplyMismatchat once, and any other bus error is raised as theOSErrorit is.sendis never retried, since a SET need not be safe to repeat. - the reply is corrupt (a Raspberry Pi's I2C controller ignores clock
stretching, so a reply the peripheral is still building can read as
-
Controller.scanreads each address once and writes nothing. An address with no device, or one that answers with something that is not a frame, is skipped; any other bus error is raised. -
A
Controllermay be shared between threads: each exchange holds its lock, so one thread's GET is never interleaved with another's. -
Protocol errors share the base
CrumbsError(FrameError,ReplyMismatch); bus errors areOSError. -
LinuxBususes/dev/i2c-Nlike the C library's Linux HAL: theI2C_SLAVEioctl, then a plain write or read. Anything with the samewrite(address, data)andread(address, count)methods works as a bus.
The package version is the CRUMBS library version it matches.
Licence
AGPL-3.0-or-later, like CRUMBS.
Metadata
Release files for crumbs-i2c 0.15.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| crumbs_i2c-0.15.0.tar.gz | 20.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| crumbs_i2c-0.15.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.3 kB
Release files / crumbs_i2c-0.15.0.tar.gz
| Download URL | crumbs_i2c-0.15.0.tar.gz |
|---|---|
| Size | 20.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0d226057424ffbd1eb861336a012d76cd87b1c40063bb2a1d615b19904fa6e0b
|
|
BLAKE2b-256 checksum How to use checksums |
69fa9489a45f6e166006d5703fe8e57890e9ef041c88b27fb297c8f03b635ed6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.
Transparency logRelease files / crumbs_i2c-0.15.0-py3-none-any.whl
| Download URL | crumbs_i2c-0.15.0-py3-none-any.whl |
|---|---|
| Size | 21.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
08485d16ac77bd1650e2ff574d4d979c68cdc6608626d1a3971e8896350d2a0d
|
|
BLAKE2b-256 checksum How to use checksums |
7c0eae58598accd15a7fbc6ceba98d7cb3582f234852ac7a857a90310e35e648
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 4, 2026.
Transparency log