Skip to main content

MCAP libraries for Python

Project description

MCAP Python Library

This library provides classes for reading and writing the MCAP file format.

Reader Example

from mcap.mcap0.stream_reader import StreamReader

stream = open("example.mcap", "rb")
reader = StreamReader(stream)
for record in reader.records:
    print(record)

Writer Example

from time import time_ns
from mcap.mcap0.writer import Writer

stream = open("example.mcap", "wb")
writer = Writer(stream)
writer.start("ros1", "example")
schema_id = writer.register_schema(
    "example", "text/plain", data="example schema".encode()
)
channel_id = writer.register_channel(
    schema_id=schema_id,
    topic="example_topic",
    message_encoding="text/plain",
    metadata={"first": "a"},
)
writer.add_message(
    channel_id=channel_id,
    log_time=time_ns(),
    data="example message".encode(),
    publish_time=time_ns(),
)
writer.finish()
stream.close()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcap-0.0.3.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcap-0.0.3-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file mcap-0.0.3.tar.gz.

File metadata

  • Download URL: mcap-0.0.3.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for mcap-0.0.3.tar.gz
Algorithm Hash digest
SHA256 dec15874d40508e7b439a59c1740409857cd3e21d59354a1ab5bed18b1eec0b2
MD5 fa3ce4dbd16ff9515b35e9207def06ef
BLAKE2b-256 eb163c605ffdc1edf1afde6ae5ab5d72d1594e51ad0f0126978cf6c912991014

See more details on using hashes here.

File details

Details for the file mcap-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: mcap-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for mcap-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a5aae217c15766be15d52a5cfa849449e76252566557171db170f491ee6df8ad
MD5 5ed73e1ab5ce921dca98bda91cf9470a
BLAKE2b-256 ce02ad6e38155f5434ff4d806891247cd968baf1db59d68662c24df89e96d28a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page