Metadata-Version: 2.4
Name: et-ws
Version: 0.1.0
Summary: Generated Pydantic models for the Edge Toolkit WS protocol
Keywords: asyncapi,edge-computing,edge-toolkit,pydantic,websocket
Author: John Vandenberg
Author-email: John Vandenberg <john.vandenberg@curtin.edu.au>
License-Expression: Apache-2.0 OR MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Pydantic :: 2
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet
Classifier: Topic :: System :: Distributed Computing
Classifier: Typing :: Typed
Requires-Dist: pydantic>=2
Requires-Python: >=3.10
Project-URL: Changelog, https://github.com/edge-toolkit/core/blob/main/CHANGELOG.md
Project-URL: Homepage, https://github.com/edge-toolkit/core
Project-URL: Issues, https://github.com/edge-toolkit/core/issues
Project-URL: Source, https://github.com/edge-toolkit/core/tree/main/generated/python-ws
Description-Content-Type: text/markdown

# et-ws

Pydantic v2 models for the WebSocket protocol of [Edge Toolkit](https://github.com/edge-toolkit/core), a framework
for running workloads across a fleet of devices that all connect to one WebSocket hub. Every message an agent may
send to the hub is a model here, so a Python agent builds its frames with validation rather than by hand.

## Install

```sh
pip install et-ws
```

## Usage

`ClientMessage` is the union of everything an agent sends; each variant is its own model, discriminated by `type`:

```python
from et_ws.messages import ClientMessage, WsBroadcastMessage

frame = WsBroadcastMessage(type="et-broadcast-message", message={"hello": "world"}).model_dump_json()
parsed = ClientMessage.model_validate_json(frame)
```

The full message catalogue, including the hub's replies, is the
[AsyncAPI specification](https://github.com/edge-toolkit/core/blob/main/generated/specs/ws.yaml).

## Regenerating

`et_ws/messages.py` is generated from the Rust `ClientMessage` in `libs/edge-toolkit/src/ws.rs` by
`mise run gen:python-ws`. This README and `pyproject.toml` are maintained by hand.

## License

Licensed under either of [Apache License, Version 2.0](https://github.com/edge-toolkit/core/blob/main/LICENSE-APACHE)
or [MIT license](https://github.com/edge-toolkit/core/blob/main/LICENSE-MIT) at your option.
