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
import json
from mcap.mcap0.writer import Writer
stream = open("example.mcap", "wb")
writer = Writer(stream)
# The library argument help identify what tool wrote the file.
writer.start(profile="x-custom", library="my-writer-v1")
schema_id = writer.register_schema(
name="sample",
encoding="jsonschema",
data=json.dumps({
"type": "object",
"properties": {
"sample": {
"type": "string",
}
}
}).encode()
)
channel_id = writer.register_channel(
schema_id=schema_id,
topic="sample_topic",
message_encoding="json",
)
writer.add_message(
channel_id=channel_id,
log_time=time_ns(),
data=json.dumps({"sample": "test"}).encode('utf-8'),
publish_time=time_ns(),
)
writer.finish()
stream.close()
Project details
Release history Release notifications | RSS feed
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.5.tar.gz
(11.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
mcap-0.0.5-py3-none-any.whl
(14.5 kB
view details)
File details
Details for the file mcap-0.0.5.tar.gz.
File metadata
- Download URL: mcap-0.0.5.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1223c1b92d0b6369e0cfceabd180af2e0ff797034ec3ed1414e23d0bfa3f28a4
|
|
| MD5 |
a44830aedcef1c796c6c921d9814006d
|
|
| BLAKE2b-256 |
82b53c5997ecaa825205bfa7d565840fc232042316521005801d659b3adcbcfb
|
File details
Details for the file mcap-0.0.5-py3-none-any.whl.
File metadata
- Download URL: mcap-0.0.5-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
320bf3db298e6ccf780aad2fffda6f06decb512bf644505a042198887eb7ed9a
|
|
| MD5 |
d5472a9e0bce3829f082de9a1ea81bc7
|
|
| BLAKE2b-256 |
31b93ce0cae9dc5ec94ed24aa1d85db7794d32a5991b650b55ea913615fd486c
|