The Foxglove Python SDK provides tools for streaming data (e.g., sensor data, robot state, custom messages) from Python applications to Foxglove Studio for visualization and debugging. It's actively maintained with regular releases, currently at version 0.21.0, targeting Python 3.10 and newer, leveraging asynchronous operations for efficient data transfer.
pip install foxglove-sdkVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to connect to a Foxglove WebSocket server, define a new stream with a JSON schema, and publish messages asynchronously. Ensure you have a Foxglove WebSocket server running (e.g., locally via `npx @foxglove/ws-server` if you have Node.js installed, or connect to a cloud endpoint).
Replace `from foxglove_sdk.client import Client` with `from foxglove_sdk import FoxgloveClient`. Instead of `client.publisher.send()`, use `client.send_message()` directly.
Update all references from 'channel' to 'stream' in class names, method calls, and parameter names (e.g., `add_channel` -> `add_stream`, `channelId` -> `streamId`).
Ensure your application uses an `asyncio` event loop. Wrap the main logic in an `async def main():` function and run it with `asyncio.run(main())`. Always use `await` when calling `FoxgloveClient` methods like `connect()`, `add_stream()`, or `send_message()`.
Before sending, serialize your message object (e.g., `json.dumps(my_dict).encode('utf8')` for JSON, or `my_proto_message.SerializeToString()` for Protobuf) and ensure the schema and encoding in `AddStreamRequest` match this format.