mcap-ros2idl-support
A Python library to read and parse ROS 2 MCAP bag files without a ROS 2 runtime. It extracts schemas from rosbag2 messages and decodes their CDR payloads.
See CHANGELOG.md for release notes and breaking changes.
Features
- Read-only parsing of MCAP/rosbag2 files without needing a ROS 2 runtime
- Treats each struct as a Python
dictinstead of generating dynamic classes - Decodes CDR payloads in Rust;
uint8arrays default tobytesfor speed
Installation
Supports CPython 3.10–3.15. Building from source also requires Rust and Cargo. The package uses a Rust/PyO3 decoder built with maturin.
Install the Python package:
pip install .
Usage
Python example
from mcap.reader import make_reader
from mcap_ros2idl_support import Ros2DecodeFactory
factory = Ros2DecodeFactory()
with open("sample.mcap", "rb") as f:
reader = make_reader(f, decoder_factories=[factory])
for decoded in reader.iter_decoded_messages():
print(decoded.channel.topic)
print(decoded.decoded_message)
Byte-array compatibility
The factory defaults to Ros2DecodeFactory(array_mode="bytes"). uint8[] and
fixed uint8[N] fields return immutable bytes; all other arrays remain lists.
This substantially reduces the time and memory needed for image/point-cloud data.
Use Ros2DecodeFactory(array_mode="list") for the previous list representation,
including direct JSON serialization. The MCAP decoder factory interface and
enum_as_string option are unchanged.
See DESIGN.md for compatibility details and benchmarks/README.md for sample benchmarks.
Command line
python examples/cli.py --mcap-file sample.mcap
Use the --enum-as-string flag to return enumeration values as strings:
python examples/cli.py --mcap-file sample.mcap --enum-as-string
Development
-
Create and activate a virtual environment:
python -m venv .venv source .venv/bin/activate
-
Install project and development dependencies:
pip install -e '.[dev]'
-
Install and run
pre-commit:pre-commit install pre-commit run --files <file> [<file> ...]
To check the entire repository, use:
pre-commit run --all-files
-
Run tests with
pytest:pytest
Building the wheel
The Package build workflow runs on pushes
to develop, pull requests, manual dispatches, and calls from other workflows.
It builds and tests CPython 3.10+ abi3 wheels for Linux x86_64 and aarch64
(manylinux2014), macOS Apple Silicon and Intel, and Windows x86_64.
On Linux x86_64, separate jobs install and test the same built wheel on
Python 3.10–3.15 without rebuilding Rust. Wheels and a source distribution
are available in the workflow run's Artifacts section.
-
Clean old artifacts:
rm -rf dist
-
Install the build backend:
python -m pip install --upgrade build
-
Build the wheel:
python -m build
-
(Optional) Verify the wheel locally:
python -m pip install dist/mcap_ros2idl_support-<version>-cp310-abi3-<platform>.whl
-
(Optional) Upload to PyPI:
python -m pip install --upgrade twine python -m twine upload dist/*
Releasing to PyPI
The Release workflow runs when a v* tag is
pushed. It checks that the tag matches the versions in both pyproject.toml and
Cargo.toml, builds and tests all five platform wheels, including the Linux
Python 3.10–3.15 compatibility matrix, then publishes the wheels and source
distribution to PyPI.
Before the first release, create the GitHub Actions environment pypi and
configure a PyPI Trusted Publisher
for the project with these values:
- Owner:
dskkato - Repository:
mcap-ros2idl-support - Workflow filename:
release.yml - Environment:
pypi
No PyPI API token secret is required. Update both package versions, commit the changes, and push a matching tag on that commit, for example:
git tag v0.2.0
git push origin v0.2.0
Use a new version for each release; PyPI does not allow replacing published files.
Project structure
The repository is organized as follows:
mcap_ros2idl_support/– core Python packagecdr/– helpers for reading and writing CDR streamsros2idl_parser/– parser forros2idlschema definitionsrosmsg/– parser for classic.msgmessage definitionsrosmsg2_serialization/– utilities for decoding CDR payloads into dictionariesdecode_factory.py– integrates parsers and the Rust decoder with MCAP
src/lib.rs– native CDR decoderbenchmarks/– reproducible reading and decoding comparisonsexamples/– example CLI demonstrating how to iterate decoded messagestests/– unit tests for the library
Design notes
- Uses Foxglove’s
@foxglove/ros2idl-parserto handle.idlfiles in addition to classic.msgdefinitions. - MCAP file writing is not supported, though CDR encoding helpers are available for individual messages.
- Enumerations defined in IDL can be returned as their string values by
enabling
enum_as_string. - The goal is to enable parsing MCAP bags without any ROS 2 dependencies to make offline analysis easier.
Metadata
Release files for mcap-ros2idl-support 0.2.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 | Provenance | Actions |
|---|---|---|---|---|
| mcap_ros2idl_support-0.2.0.tar.gz | 60.6 kB | With provenance | Details for mcap_ros2idl_support-0.2.0.tar.gz |
Built distributions (wheels)
Total release size: 1.5 MB
Release files / mcap_ros2idl_support-0.2.0.tar.gz
| Download URL | mcap_ros2idl_support-0.2.0.tar.gz |
|---|---|
| Size | 60.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
376d6a22c1a40290c5ec8bdbcdc3664d050a4c3c4f4b4433ea90cd96a00e6cd3
|
|
BLAKE2b-256 checksum How to use checksums |
36e94e20b2e8a7bd1c845ee904c1dc324a62f201dcaac1fdc5b9d3d9365e850c
|
| 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 13, 2026.
Transparency logRelease files / mcap_ros2idl_support-0.2.0-cp310-abi3-win_amd64.whl
| Download URL | mcap_ros2idl_support-0.2.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 201.5 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
7b230f19303b2ace4abfe431452edaf42f49ed0819ff21fee29c1df39031035a
|
|
BLAKE2b-256 checksum How to use checksums |
e43bd47391ef7964f5a9b3fe7f0dd87934cfbf378b8855c2dc7c5bbd1204534a
|
| 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 13, 2026.
Transparency logRelease files / mcap_ros2idl_support-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | mcap_ros2idl_support-0.2.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 320.5 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
7ee640102dd9ce8dc14eeccf5c814d83aa28b8890637fc20f21c4806e218f170
|
|
BLAKE2b-256 checksum How to use checksums |
8125bcd1c811f7f8ac7a5bd45be1a282776bb5bab8b4f9b6f6d4c8759defe377
|
| 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 13, 2026.
Transparency logRelease files / mcap_ros2idl_support-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | mcap_ros2idl_support-0.2.0-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 323.7 kB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
30ca487a24c70e38d11bdfbbc8ff798eb4e1097d34713ca1a2035bb45735dba7
|
|
BLAKE2b-256 checksum How to use checksums |
1c8bcde481ad0d610cce2c293619ba71eba752da00b6dd708ec3336c64841f53
|
| 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 13, 2026.
Transparency logRelease files / mcap_ros2idl_support-0.2.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | mcap_ros2idl_support-0.2.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 299.5 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
8e9ab977758b1fce8137a76a6061d58c5da297febec277c51c2e193400e5d0d2
|
|
BLAKE2b-256 checksum How to use checksums |
a70589142f3571f78e7d3d44df89b84c39fad983a384086b76dd2372dfba1e80
|
| 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 13, 2026.
Transparency logRelease files / mcap_ros2idl_support-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl
| Download URL | mcap_ros2idl_support-0.2.0-cp310-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 298.4 kB |
| Tags | CPython 3.10 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
a13f97e8caf697197cf171051f8d56b98dd42f837fa8f68d6d7b034ba30ee72d
|
|
BLAKE2b-256 checksum How to use checksums |
1539abcb922d9a28f0827d0e771a508f622878064c5e257700047dc6e9c6861c
|
| 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 13, 2026.
Transparency logSecurity for mcap-ros2idl-support 0.2.0
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.
Full provenance
All 6 files in this release have been uploaded with provenance metadata.
Attestation for mcap_ros2idl_support-0.2.0.tar.gz
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 13, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.