edgefirst-schemas (Python)
Zero-copy CDR message types for EdgeFirst Perception. Wraps the
edgefirst-schemas Rust crate via PyO3.
pip install edgefirst-schemas
The wheel ships two stable-ABI families per OS/architecture:
cp311-abi3— Python 3.11+, zero-copyPy_bufferpath (pip prefers this on 3.11+)cp38-abi3— Python 3.8–3.10 (and 3.11+ if the other wheel is absent); constructors copy andBorrowedBuf.view()returnsbytes
See abi3-py38 builds for the older-ABI tradeoffs.
Quick start
from edgefirst.schemas.builtin_interfaces import Time
from edgefirst.schemas.std_msgs import Header
from edgefirst.schemas.sensor_msgs import Image
import numpy as np
pixels = np.zeros((720, 1280, 3), dtype=np.uint8)
img = Image(
header=Header(stamp=Time(sec=1, nanosec=0), frame_id="cam"),
height=720, width=1280, encoding="rgb8",
is_bigendian=0, step=1280 * 3,
data=pixels, # any contiguous buffer-protocol object
)
# Zero-copy view of the pixel data — `np.frombuffer` aliases the same
# bytes the message was constructed with, no copy.
arr = np.frombuffer(img.data, dtype=np.uint8).reshape(720, 1280, 3)
# Wire bytes for transport:
buf = img.to_bytes()
img2 = Image.from_cdr(buf)
assert img2.width == 1280
Forwarding raw CDR bytes without a copy
For publish paths where you want to hand the wire bytes straight to a
transport (Zenoh, raw socket, mcap writer), cdr_view() exposes the
full CDR buffer (header + payload) as a zero-copy BorrowedBuf:
transport.publish(memoryview(img.cdr_view())) # zero-copy
to_bytes() is the explicit-copy alternative when the consumer wants
an owned bytes value.
Zero-copy contract — BorrowedBuf
Every bulk byte payload (Image.data, Mask.mask, RadarCube.cube,
PointCloud2.data, CompressedVideo.data, CompressedImage.data)
returns a BorrowedBuf view that aliases the parent message's bytes —
not a copy. The BorrowedBuf holds a strong reference to the parent,
so it's safe to keep it (or a memoryview derived from it) live after
the original message reference is dropped.
| Method | Returns | Cost |
|---|---|---|
borrowed_buf itself |
wraps the bytes | zero-copy, O(1) |
np.frombuffer(borrowed_buf, dtype=...) |
numpy ndarray aliasing the bytes | zero-copy, O(1) (Py 3.11+) |
memoryview(borrowed_buf) |
parent-anchored memoryview | zero-copy, O(1) (Py 3.11+) |
borrowed_buf.tobytes() |
owned bytes |
one memcpy |
borrowed_buf.view() |
memoryview (Py 3.11+) / bytes (abi3-py38) | zero-copy / one memcpy |
Migrating from the pycdr2-backed edgefirst.schemas
This release replaces the pure-Python pycdr2 codec with a Rust-backed
pyo3 binding. Wire-format bytes are unchanged — anything encoded by the
previous pycdr2 module decodes through from_cdr() and vice-versa — but
the Python API surface is narrower and stricter.
What changed at the call site
# pycdr2-backed (old) # pyo3-backed (new)
img = Image() img = Image(
img.height = 720 header=Header(stamp=Time(1, 0)),
img.width = 1280 height=720, width=1280,
img.encoding = "rgb8" encoding="rgb8", is_bigendian=0,
img.data = pixels step=1280 * 3, data=pixels,
buf = img.serialize() )
img2 = Image.deserialize(buf) buf = img.to_bytes()
img2 = Image.from_cdr(buf)
| pycdr2 pattern | pyo3 replacement |
|---|---|
Foo() then field assignment |
Foo(field=value, …) constructor only — pyclasses are frozen |
.serialize() |
.to_bytes() |
Foo.deserialize(buf) |
Foo.from_cdr(buf) |
msg.data returning bytes |
msg.data returning BorrowedBuf (zero-copy view); use .tobytes() for the old shape |
from_schema(), decode_pcd(), colormap(), registry helpers |
removed — the legacy module survives only at benches/python/legacy/ for benchmark parity |
std_msgs.{String, Int32, Float64, …} primitive wrappers |
removed — these were pycdr2-generated single-value wrappers; pass raw Python values instead |
| Mutable dataclass-style instances | Frozen pyclasses; rebuild instead of mutate |
What stays the same
- All field names and types match the ROS 2 / Foxglove / EdgeFirst schemas verbatim.
- Wire-format CDR1 LE bytes are byte-equivalent across versions.
- The
edgefirst.schemas.<submodule>import paths (sensor_msgs.Image,std_msgs.Header, etc.) are preserved.
abi3-py38 builds — typed numpy caveats
The default published wheel on Python 3.11+ is cp311-abi3, where the
buffer protocol is in the limited API and typed numpy arrays
(np.uint16, np.float32, …) work zero-copy as constructor inputs.
On the cp38-abi3 wheel (Python 3.8–3.10, or a source build with
--features abi3-py38) the buffer protocol isn't available; pass
arr.tobytes() for typed arrays, and BorrowedBuf.view() returns
bytes (one copy) instead of a parent-anchored memoryview. Plain
bytes / bytearray / np.uint8 arrays work on either build.
shape = np.array([2, 128, 12, 128], dtype=np.uint16)
# Default cp311-abi3 wheel — works directly:
RadarCube(..., shape=shape, ...)
# abi3-py38 build — pass bytes:
RadarCube(..., shape=shape.tobytes(), ...)
Build from source
Default local develop (cp311-abi3, Python 3.11+ zero-copy):
maturin develop --release --manifest-path crates/python/Cargo.toml
cp38-abi3 wheel (Python 3.8+; copy-fallback on typed buffers):
maturin build --release \
--manifest-path crates/python/Cargo.toml \
--no-default-features --features abi3-py38
Cross-compile manylinux2014 wheels via zig:
maturin build --release --zig --compatibility manylinux2014 \
--target aarch64-unknown-linux-gnu \
--manifest-path crates/python/Cargo.toml
Release files for edgefirst-schemas 4.0.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 | |
|---|---|---|---|
| edgefirst_schemas-4.0.0.tar.gz | 217.3 kB | Details |
Built distributions (wheels)
Total release size:6.0 MB
Release files / edgefirst_schemas-4.0.0.tar.gz
| Download URL | edgefirst_schemas-4.0.0.tar.gz |
|---|---|
| Size | 217.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
959632e1f1123ec0da89b8ed9963b612df60b52031410c17f1535d5c88ebed88
|
|
BLAKE2b-256 checksum How to use checksums |
d23586fd7dcedb0745a715462ef9d4021a5b1ca912be9772fec381fffd7fdf11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Aug 28, 2026.
Transparency logRelease files / edgefirst_schemas-4.0.0-cp311-abi3-win_amd64.whl
| Download URL | edgefirst_schemas-4.0.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 542.7 kB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
3ffee652e4969869d22ab8a2186718af551213ea8f171a7dd3a2ac6b8fdfeb53
|
|
BLAKE2b-256 checksum How to use checksums |
367bb8dcee3c28dbd3d2a3954eec14aed939fbfc2c8c23fd1f6b3909cff61bd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Aug 28, 2026.
Transparency logRelease files / edgefirst_schemas-4.0.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | edgefirst_schemas-4.0.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 615.3 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
486e0b642582ab6059b56cc853cf3bdcf0f82e46033c26816ba642287657445f
|
|
BLAKE2b-256 checksum How to use checksums |
8b02fd7e04119f14344553cf4fed2bd1ef673c1bfd445f66c7d8d4d5886878a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Aug 28, 2026.
Transparency logRelease files / edgefirst_schemas-4.0.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | edgefirst_schemas-4.0.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 582.4 kB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
2b5035826e321b71f4636aa81a8c0d135e21545f8cffb0fb26feec33ab07a422
|
|
BLAKE2b-256 checksum How to use checksums |
da11a25b01053401c178ffe7d1b9b5d2734788985609918b2954d099c312b22e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Aug 28, 2026.
Transparency logRelease files / edgefirst_schemas-4.0.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | edgefirst_schemas-4.0.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 566.8 kB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
746b3aecc030883500d357bc60af8539ea57ff9be2756e2372eec75d5fc80e83
|
|
BLAKE2b-256 checksum How to use checksums |
206f06ac915119c8761a12491a4abc8c5f0538ce98f422810e32036a0fd1173a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Aug 28, 2026.
Transparency logRelease files / edgefirst_schemas-4.0.0-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | edgefirst_schemas-4.0.0-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 577.4 kB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
905826a3723edbe73cdfff9f3b9c5e0c9033407391107ec1738fc1d1b9ecc6f0
|
|
BLAKE2b-256 checksum How to use checksums |
b969ea3a9667f0f4d911abd740e788e45493e42dc38bad5d5f77ecac32626f42
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Aug 28, 2026.
Transparency logRelease files / edgefirst_schemas-4.0.0-cp38-abi3-win_amd64.whl
| Download URL | edgefirst_schemas-4.0.0-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 547.3 kB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
954fe6ff04bcc958ca3c56b5a1fa3ff624f3bb993cf80214447b99246f6f3427
|
|
BLAKE2b-256 checksum How to use checksums |
1d45779eed9eeba663d3c5206057dbfa9b7ed3dbcf9d35bf40299066b4dc4eb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Aug 28, 2026.
Transparency logRelease files / edgefirst_schemas-4.0.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | edgefirst_schemas-4.0.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 620.5 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
a613e7f4ed46b54d859cd918edae7dc8f8f2b4fec0c2df05e69dbee7cf8ae68c
|
|
BLAKE2b-256 checksum How to use checksums |
3bd5d76d16c2465a9590e0f4de3ae8e3fe423b662454c4d375464c8b1954412c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Aug 28, 2026.
Transparency logRelease files / edgefirst_schemas-4.0.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | edgefirst_schemas-4.0.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 586.4 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
94d8ad2aff620fd5b982a302ef198a2c34f1939068965ca1a996804b30f3df0f
|
|
BLAKE2b-256 checksum How to use checksums |
91d7dcbacdbcec05a2aac689d00569a3a0d1ac0ec93f144d4acce3eb5becec6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Aug 28, 2026.
Transparency logRelease files / edgefirst_schemas-4.0.0-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | edgefirst_schemas-4.0.0-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 567.7 kB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
7231c8ed16a23cd29b38e2b1ccc4323b950a56504b57567ccc789cd92db743e7
|
|
BLAKE2b-256 checksum How to use checksums |
9757f1776600c38ecdfadbff3c577d29c3282cf4b363f98635a1a5615d742cff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Aug 28, 2026.
Transparency logRelease files / edgefirst_schemas-4.0.0-cp38-abi3-macosx_10_12_x86_64.whl
| Download URL | edgefirst_schemas-4.0.0-cp38-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 577.7 kB |
| Tags | CPython 3.8 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
8715a791f418145f829bfb5682866d733d4bfaeff7c021a446dfc49f39f97b85
|
|
BLAKE2b-256 checksum How to use checksums |
25fe2ac46f4702c753836300edfdb53f204bb40734b72bfe950120bbcd4db74b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Aug 28, 2026.
Transparency log