osi-utilities (Python)
Python utilities for reading and writing ASAM OSI (Open Simulation Interface) trace files.
Supported Formats
- MCAP (
.mcap) - Multi-channel container format with metadata - Binary (
.osi) - Single-channel binary format with length-prefixed protobuf messages - Text (
.txth) - Human-readable protobuf TextFormat
Installation
From PyPI:
pip install asam-osi-utilities
For development (uses a virtual environment):
make setup # creates .venv and installs in editable mode
API Entrypoints
The package exposes two API levels:
Channel abstraction(simple API) viaopen_channel(...)
- Use this when you want to read one logical channel and get protobuf messages directly.
- Works across
.osiand.mcap.
Advanced tracefile APIviacreate_reader(...)and concrete readers/writers
- Use this when you need explicit control over topics, decoder mode, metadata, writer behavior, or multi-channel features.
Quick Start
1) Channel abstraction (simple API)
from pathlib import Path
from osi_utilities import ChannelSpecification, MessageType, open_channel
# Single channel from an MCAP file (explicit topic)
spec = ChannelSpecification(
path=Path("trace.mcap"),
topic="GroundTruthTopic",
message_type=MessageType.GROUND_TRUTH,
)
with open_channel(spec) as channel:
for message in channel:
print(type(message).__name__)
Channel abstraction writing uses open_channel_writer(...):
from pathlib import Path
from osi3.osi_groundtruth_pb2 import GroundTruth
from osi_utilities import ChannelSpecification, MessageType, open_channel_writer
spec = ChannelSpecification(
path=Path("output.osi"),
message_type=MessageType.GROUND_TRUTH,
)
msg = GroundTruth()
msg.timestamp.seconds = 1
with open_channel_writer(spec) as channel_writer:
channel_writer.write_message(msg)
2) Advanced reading API
from pathlib import Path
from osi_utilities import MultiTraceReader, create_reader
# Create reader by extension (.osi/.mcap/.txth), then configure explicitly
path = Path("trace.mcap")
reader = create_reader(path)
if isinstance(reader, MultiTraceReader):
reader.set_topics(["GroundTruthTopic"])
if not reader.open(path):
raise RuntimeError(f"Failed to open {path}")
with reader:
for result in reader:
print(result.message_type, result.message)
Advanced configuration helpers based on ChannelSpecification are also available in osi_utilities.tracefile.configure:
from pathlib import Path
from osi_utilities import create_reader
from osi_utilities.api import ChannelSpecification, MessageType
from osi_utilities.tracefile.configure import configure_reader, configure_reader_for_channels
path = Path("trace.mcap")
reader = create_reader(path)
# Configure from one channel spec
configure_reader(
reader,
ChannelSpecification(
path=path,
topic="GroundTruthTopic",
message_type=MessageType.GROUND_TRUTH,
),
)
# Or configure from multiple channel specs (same file path)
configure_reader_for_channels(
reader,
[
ChannelSpecification(path=path, topic="GroundTruthTopic", message_type=MessageType.GROUND_TRUTH),
ChannelSpecification(path=path, topic="SensorDataTopic", message_type=MessageType.SENSOR_DATA),
],
)
3) Writing (advanced API)
from pathlib import Path
from osi3.osi_sensorview_pb2 import SensorView
from osi_utilities import SingleTraceWriter
sensor_view = SensorView()
sensor_view.version.version_major = 3
sensor_view.timestamp.seconds = 123
sensor_view.timestamp.nanos = 456
with SingleTraceWriter() as writer:
writer.open(Path("output.osi"))
writer.write_message(sensor_view)
For multi-channel MCAP writing, use MultiTraceWriter or MCAPChannel.
Development
make setup # Create venv and install dependencies
make test # Run tests
make lint # Run linter
make format # Format code
make typecheck # Run type checker
Metadata
Release files for asam-osi-utilities 0.4.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 |
|---|---|---|---|---|
| asam_osi_utilities-0.4.0.tar.gz | 38.3 kB | With provenance | Details for asam_osi_utilities-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| asam_osi_utilities-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for asam_osi_utilities-0.4.0-py3-none-any.whl |
Total release size: 80.7 kB
Release files / asam_osi_utilities-0.4.0.tar.gz
| Download URL | asam_osi_utilities-0.4.0.tar.gz |
|---|---|
| Size | 38.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c00c4fdadb00f29e6440b107488c1371499a4886b0ff16d9f63ea96ea5606632
|
|
BLAKE2b-256 checksum How to use checksums |
d4ecd5f41c43c5c730f450b3ac2608e0d26d00de6a2542914a6fd963fca4fb20
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 28, 2026.
Transparency logRelease files / asam_osi_utilities-0.4.0-py3-none-any.whl
| Download URL | asam_osi_utilities-0.4.0-py3-none-any.whl |
|---|---|
| Size | 42.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b0392f2b1b9be6b920a5e74f78b63ad0c286b60476ce063c94caa39b1dfa1153
|
|
BLAKE2b-256 checksum How to use checksums |
bc410f27c4754a785a921f0a948d669c2ce1dce4cc5d6c94d787cc5b83fe77f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Apr 28, 2026.
Transparency logSecurity for asam-osi-utilities 0.4.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
Both files in this release have been uploaded with provenance metadata.
Attestation for asam_osi_utilities-0.4.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 Apr 28, 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.