semvec/pypi-packages huggingface dataset:
owa-msgs 0.6.5
Core message definitions for Open World Agents
License: MIT
Requires Python: >=3.11

# owa-msgs

Core message definitions for Open World Agents (OWA).

This package provides the standard message types used throughout the OWA ecosystem, organized by domain and registered through Python entry points for automatic discovery.

## Installation

```bash
pip install owa-msgs
```

## Usage

### Using the Message Registry

The recommended way to access messages is through the global registry:

```python
from owa.core import MESSAGES

# Access message classes by type name
KeyboardEvent = MESSAGES['desktop/KeyboardEvent']
MouseEvent = MESSAGES['desktop/MouseEvent']

# Create message instances
event = KeyboardEvent(event_type="press", vk=65)
```

### Direct Imports

You can also import message classes directly:

```python
from owa.msgs.desktop.keyboard import KeyboardEvent
from owa.msgs.desktop.mouse import MouseEvent
```

### Discovering Available Message Types

To see all available message types, use the CLI command:

```bash
owl messages list
```

Or programmatically:

```python
from owa.core import MESSAGES

# List all available message types
for message_type in sorted(MESSAGES.keys()):
    print(f"- {message_type}")

# Get detailed information about a specific message
print(f"Total messages: {len(MESSAGES)}")
```

### Getting Message Details

For detailed information about any message type:

```bash
# Show comprehensive details about a message
owl messages show desktop/KeyboardEvent

# Show with usage examples
owl messages show desktop/KeyboardEvent --example

# Validate all messages
owl messages validate
```

## Message Domains

Messages are organized by domain for better structure:

- **Desktop Domain** (`desktop/*`): Desktop interaction messages including keyboard, mouse, window, and screen capture events

## Extending with Custom Messages

To add custom message types, create a package with entry point registration:

```toml
# pyproject.toml
[project.entry-points."owa.msgs"]
"custom/MyMessage" = "my_package.messages:MyMessage"
```

## Schema and Compatibility

All messages implement the `BaseMessage` interface from `owa.core.message` and are compatible with the OWAMcap format for data recording and playback.
mcap-owa-support 0.6.5
OWA support for the Python MCAP library
License: MIT
Requires Python: >=3.11

# Copied from https://github.com/foxglove/mcap/tree/main/python/mcap-ros1-support


### Usage Demo

```python
import tempfile

from mcap_owa.highlevel import OWAMcapReader, OWAMcapWriter
from owa.core.message import OWAMessage
from owa.core import MESSAGES

# Access message types through the global registry
KeyboardEvent = MESSAGES['desktop/KeyboardEvent']

class String(OWAMessage):
    _type = "std_msgs/String"
    data: str


def main():
    with tempfile.TemporaryDirectory() as tmpdir:
        file_path = tmpdir + "/output.mcap"
        
        # Writing messages to an OWAMcap file
        with OWAMcapWriter(file_path) as writer:
            for i in range(0, 10):
                publish_time = i
                if i % 2 == 0:
                    topic = "/chatter"
                    event = String(data="string message")
                else:
                    topic = "/keyboard"
                    event = KeyboardEvent(event_type="press", vk=1)
                writer.write_message(event, topic=topic, timestamp=publish_time)

        # Reading messages from an OWAMcap file
        with OWAMcapReader(file_path, decode_args={"return_dict": True}) as reader:
            for mcap_msg in reader.iter_messages():
                print(f"Topic: {mcap_msg.topic}, Timestamp: {mcap_msg.timestamp}, Message: {mcap_msg.decoded}")


if __name__ == "__main__":
    main()
```

For above script, stdout is following:
```
Topic: /chatter, Timestamp: 1741767097157638598, Message: {'data': 'string message'}
Topic: /keyboard, Timestamp: 1741767097157965764, Message: {'event_type': 'press', 'vk': 1}
Topic: /chatter, Timestamp: 1741767097157997762, Message: {'data': 'string message'}
Topic: /keyboard, Timestamp: 1741767097158019602, Message: {'event_type': 'press', 'vk': 1}
Topic: /chatter, Timestamp: 1741767097158036925, Message: {'data': 'string message'}
Topic: /keyboard, Timestamp: 1741767097158051239, Message: {'event_type': 'press', 'vk': 1}
Topic: /chatter, Timestamp: 1741767097158065463, Message: {'data': 'string message'}
Topic: /keyboard, Timestamp: 1741767097158089318, Message: {'event_type': 'press', 'vk': 1}
Topic: /chatter, Timestamp: 1741767097158113250, Message: {'data': 'string message'}
Topic: /keyboard, Timestamp: 1741767097158129738, Message: {'event_type': 'press', 'vk': 1}
```