Metadata-Version: 2.4
Name: asam-osi-utilities
Version: 0.3.1
Summary: Python utilities for reading and writing ASAM OSI trace files (MCAP, binary .osi, text .txth)
Project-URL: Homepage, https://github.com/lichtblick-suite/asam-osi-utilities
Project-URL: Documentation, https://lichtblick-suite.github.io/asam-osi-utilities/
Project-URL: Repository, https://github.com/lichtblick-suite/asam-osi-utilities
Project-URL: Issues, https://github.com/lichtblick-suite/asam-osi-utilities/issues
Author: BMW AG
License: MPL-2.0
Keywords: automated-driving,mcap,open-simulation-interface,osi,protobuf,simulation
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: mcap-protobuf-support>=0.5
Requires-Dist: mcap>=1.1
Requires-Dist: protobuf>=6.30.2
Provides-Extra: dev
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: mypy-protobuf; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Provides-Extra: docs
Requires-Dist: breathe>=4.35; extra == 'docs'
Requires-Dist: furo>=2024.0; extra == 'docs'
Requires-Dist: myst-parser>=3.0; extra == 'docs'
Requires-Dist: sphinx-copybutton; extra == 'docs'
Requires-Dist: sphinx>=7.0; extra == 'docs'
Description-Content-Type: text/markdown

# 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:

```bash
pip install asam-osi-utilities
```

For development (uses a virtual environment):

```bash
make setup    # creates .venv and installs in editable mode
```

## Quick Start

### Reading

```python
from osi_utilities.tracefile import open_trace_file

# Read any supported format (auto-detected from extension)
with open_trace_file("trace.mcap") as reader:
    for result in reader:
        print(result.message_type, result.message)
```

### Writing

```python
from pathlib import Path
from osi3.osi_sensorview_pb2 import SensorView
from osi_utilities.tracefile import BinaryTraceFileWriter

sensor_view = SensorView()
sensor_view.version.version_major = 3
sensor_view.timestamp.seconds = 123
sensor_view.timestamp.nanos = 456

with BinaryTraceFileWriter() as writer:
    writer.open(Path("output.osi"))
    writer.write_message(sensor_view)
```

## Development

```bash
make setup      # Create venv and install dependencies
make test       # Run tests
make lint       # Run linter
make format     # Format code
make typecheck  # Run type checker
```
