Registry / serialization / foxglove-schemas-protobuf

foxglove-schemas-protobuf

JSON →
library0.3.0pypypi✓ verified 86d ago

This library provides precompiled Protocol Buffer (protobuf) schemas for Foxglove, a web-based visualization and debugging tool for robotics. It allows Python applications to serialize and deserialize data according to Foxglove's standardized message definitions, facilitating interoperability within the Foxglove ecosystem. The current version is 0.3.0, and updates typically align with new schema definitions released by the broader Foxglove SDK.

pip install foxglove-schemas-protobuf
INSTALL
IMPORT
SIG · FOXGLOVE-SCHEMAS-P
F
foxglove-schemas-protobuf
serializationpythonv0.3.0
Install
2.0s avg
Import
172ms
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.285s · 19.9MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.0s · import 0.058s · 21MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FrameTransform
from foxglove_schemas_protobuf.FrameTransform_pb2 import FrameTransform
import foxglove_schemas_protobuf.FrameTransform
Generated protobuf messages are typically within a `_pb2` module.
Timestamp
from google.protobuf.timestamp_pb2 import Timestamp
from protobuf.timestamp_pb2 import Timestamp
Common protobuf types like Timestamp are part of the `google.protobuf` package, not directly from `foxglove_schemas_protobuf`.

This example demonstrates how to create, serialize, and deserialize a `FrameTransform` message using the `foxglove-schemas-protobuf` library. It includes importing the specific message class and a common Google Protobuf type like `Timestamp`.

from foxglove_schemas_protobuf.FrameTransform_pb2 import FrameTransform from google.protobuf.timestamp_pb2 import Timestamp # Create a Timestamp ts = Timestamp() ts.seconds = 1678886400 # Example: March 15, 2023 12:00:00 PM UTC ts.nanos = 123456789 # Create a FrameTransform message transform = FrameTransform( timestamp=ts, parent_frame_id="base_link", child_frame_id="tool0", translation_x=1.0, translation_y=0.5, translation_z=0.2, rotation_x=0.0, rotation_y=0.0, rotation_z=0.0, rotation_w=1.0 ) # Serialize to bytes serialized_data = transform.SerializeToString() print(f"Serialized FrameTransform data length: {len(serialized_data)} bytes") # Deserialize from bytes deserialized_transform = FrameTransform() deserialized_transform.ParseFromString(serialized_data) print(f"\nDeserialized Parent frame: {deserialized_transform.parent_frame_id}") print(f"Deserialized Child frame: {deserialized_transform.child_frame_id}") print(f"Deserialized Timestamp: {deserialized_transform.timestamp.seconds}.{deserialized_transform.timestamp.nanos}") assert deserialized_transform.parent_frame_id == "base_link" assert deserialized_transform.translation_x == 1.0
Debug
Known issues
gotchaThe `foxglove-schemas-protobuf` Python package may lag behind schema updates in other Foxglove SDK languages (TypeScript, C++, Rust). If you're working with the latest schema definitions in other environments, ensure your Python package version is compatible or sufficiently recent.
fix
Regularly check PyPI for new versions of `foxglove-schemas-protobuf` and update your `requirements.txt`. Consult the Foxglove schemas GitHub repository for the latest schema definitions across all languages.
affects: All versions
gotchaIncompatibility with the `protobuf` library version. Protobuf generated code is sensitive to the version of the `protobuf` runtime library installed. Mismatched versions can lead to serialization/deserialization errors or unexpected behavior.
fix
Ensure your installed `protobuf` library version is compatible with the `foxglove-schemas-protobuf` package. Typically, `pip install foxglove-schemas-protobuf` will install a compatible `protobuf` version, but if you have existing protobuf installations, check for conflicts (`pip check`).
affects: All versions
gotchaSchema definition changes between `foxglove-schemas-protobuf` versions. While Protobuf is designed for backward compatibility, changes like renaming fields, altering field types, or modifying enum values can lead to `AttributeError` during access or `DecodeError` during deserialization if an older client tries to parse data from a newer schema (or vice-versa).
fix
Always pin exact versions for `foxglove-schemas-protobuf` in your project. When upgrading, test thoroughly and review the Foxglove schema changelog for breaking or compatibility-affecting changes. Use default values for optional fields to enhance robustness.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'foxglove_schemas_protobuf.SomeSchema_pb2'
The specific schema's `_pb2` file does not exist, or the schema name is misspelled.
fix
Verify the exact schema name from the Foxglove schemas repository. The Python module structure is `foxglove_schemas_protobuf.<SchemaName>_pb2` (e.g., `ImageAnnotation_pb2`). Ensure the package is correctly installed.
google.protobuf.message.DecodeError: Truncated message
Attempting to deserialize an incomplete, corrupted, or incompatible (e.g., non-protobuf or wrong schema type) byte string.
fix
Ensure the input byte string is a complete and valid serialized Protobuf message for the target schema. Check the source of the data for corruption or mismatch. Verify that both sender and receiver are using compatible schema versions.
AttributeError: 'FrameTransform' object has no attribute 'old_field_name'
You are attempting to access a field that no longer exists or has been renamed in the version of `foxglove-schemas-protobuf` you are using, or you are trying to parse data from a newer schema version with an older client.
fix
Update your code to reflect the current schema definition by consulting the Foxglove schema documentation or upgrading your `foxglove-schemas-protobuf` package and re-evaluating the available fields. Alternatively, ensure the data being deserialized matches the expected schema version.
Upgrade
Version history
0.3.0latest on PyPI · released Feb 1, 2025
Audit
Dependencies
protobufrequiredRequired for parsing and serializing Protocol Buffer messages generated by this package.
Agent activity
4 hits · last 30 days
node
4
Resources
foxglove-schemas-protobuf — pip install foxglove-schemas-protobuf · libregistry