Fast Cyphal/CAN transfer reassembly (Python wrapper over libcanard binary)
Project description
cyphal-reassemble
Standalone reassembler of Cyphal/CAN v1.0 transfers, built on libcanard. Reads an Arrow IPC stream of pre-filtered Cyphal frames from stdin and writes an Arrow IPC stream of reassembled transfers to stdout.
Designed as a fast, compiled replacement for the pycyphal-based reassembly step of the frame-decoding pipeline. It is deliberately channel/logger/session agnostic: all such semantics stay in the calling pipeline.
Build
sudo dnf install -y libarrow-devel cmake gcc-c++ git make # Fedora
git clone --recurse-submodules <repo-url>
cd cyphal-reassemble
make
make configures and builds into build/ (Release by default). Other targets:
make clean # remove build/
make help # list targets and variables
make BUILD_TYPE=Debug # debug build
Usage
build/cyphal-reassemble < frames.arrows > transfers.arrows
build/cyphal-reassemble --help
Input schema (Arrow IPC stream)
| Column | Type | Required |
|---|---|---|
timestamp |
timestamp[us, UTC] |
yes |
id |
uint32 (29-bit CAN ID) |
yes |
data |
binary (incl. tail) |
yes |
rti |
uint8 |
no (default 0) |
Extra columns are ignored. One invocation handles one reassembly domain (typically one CAN channel).
Output schema (Arrow IPC stream)
| Column | Type | Required |
|---|---|---|
timestamp |
timestamp[us, UTC] |
yes |
type |
utf8 (Message|Request|Response) |
yes |
id |
int16 (subject-id or service-id) |
yes |
source |
uint8 (null if anonymous) |
no |
dest |
uint8 (null for messages) |
no |
priority |
uint8 |
no |
transfer_id |
uint8 |
no |
payload |
binary (raw reassembled bytes) |
no |
length |
int32 (payload byte count) |
no |
Matches sc_schema.TransferSchema minus channel, which the pipeline re-attaches.
Diagnostics and a summary line (frames_in / transfers_out / errors / oom) go
to stderr. Exit code is non-zero only on fatal I/O or schema errors.
Test
make test
Other test targets:
make test-unit # unit tests only
make test-golden # golden parity tests (tests/data/)
Golden fixtures under tests/data/ are vendored from the frame-decoding pipeline.
License
MIT
Python package
Requires uv. Build the C++ binary first (see Build above), then:
uv sync
Usage:
import pyarrow.ipc as ipc
from cyphal_reassemble import reassemble
with open("tests/data/frames_CAN1.arrows", "rb") as f:
frames = ipc.open_stream(f).read_all()
transfers = reassemble(frames)
Environment:
CYPHAL_REASSEMBLE_BIN— override path to the executable (optional)
Install from PyPI (Linux x86_64)
pip install cyphal-reassemble
# or: uv add cyphal-reassemble
Requires Linux x86_64 with glibc ≥ manylinux_2_28. The wheel bundles the
cyphal-reassemble binary and libarrow; no local C++ build needed.
Other platforms: clone this repo, run make, then uv sync (editable install).
Run Python tests:
uv run pytest python_tests/ -v
Lint:
uv run ruff check .
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cyphal_reassemble-0.1.0-py3-none-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: cyphal_reassemble-0.1.0-py3-none-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 15.3 MB
- Tags: Python 3, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78105af5a89a2e4b03e540ae5ba3e8b30c636a788d7a144b339e23bf295f499a
|
|
| MD5 |
6b4a71f1c678259e653942c1000ed57c
|
|
| BLAKE2b-256 |
078dabdec4ee57b8e62cc16aa88ff08a2d098ffa42b14fe4b43462a8a70431da
|
Provenance
The following attestation bundles were made for cyphal_reassemble-0.1.0-py3-none-manylinux_2_28_x86_64.whl:
Publisher:
wheels.yml on Finwood/cyphal-reassemble
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cyphal_reassemble-0.1.0-py3-none-manylinux_2_28_x86_64.whl -
Subject digest:
78105af5a89a2e4b03e540ae5ba3e8b30c636a788d7a144b339e23bf295f499a - Sigstore transparency entry: 2084258525
- Sigstore integration time:
-
Permalink:
Finwood/cyphal-reassemble@9767df258f56207dcc996e7f9141d8bbeb4e2983 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Finwood
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@9767df258f56207dcc996e7f9141d8bbeb4e2983 -
Trigger Event:
push
-
Statement type: