Metadata-Version: 2.4
Name: edge-toolkit
Version: 0.1.0
Summary: A collection of utilities and common code for Edge Toolkit Python modules
Keywords: cloudevents,edge-computing,edge-toolkit,pyodide,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 :: Software Development :: Libraries
Classifier: Topic :: System :: Distributed Computing
Classifier: Typing :: Typed
Requires-Dist: et-ws>=0.1.0
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/libs/python-edge-toolkit
Description-Content-Type: text/markdown

# edge-toolkit

[Edge Toolkit](https://github.com/edge-toolkit/core) is a framework for running workloads across a fleet of devices --
browser tabs, phones, native processes -- that all connect to one WebSocket hub. Agents register with the hub,
exchange messages through it, and keep per-agent files in its storage. A workload is a ws-module, and this package is
the code the Python ws-modules share, whether they run in the browser under Pyodide or natively.

## Install

```sh
pip install edge-toolkit
```

It brings in [`et-ws`](https://pypi.org/project/et-ws/), the Pydantic models of the hub's wire protocol.

## Client events

`client_event` wraps a module's data in the [CloudEvents 1.0](https://cloudevents.io/) envelope the hub expects of
an `et-client-event` message:

```python
from edge_toolkit.events import client_event

message = client_event("/modules/my-module", "app", "loaded", {"build": "1.2.3"})
frame = message.model_dump_json()
```

The event's `type` is `et.<capability>.<action>` -- `et.app.loaded` here -- and its `source` is the path the hub
serves the module from. Each call gets a fresh UUID `id` and the current UTC `time`.

## 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.
