III SDK for Python
Project description
iii-sdk
Python SDK for the iii engine.
Install
pip install iii-sdk
Hello World
import asyncio
from iii import init
async def main():
iii = init("ws://localhost:49134")
async def greet(data):
return {"message": f"Hello, {data['name']}!"}
iii.register_function("greet", greet)
iii.register_trigger(
type="http",
function_id="greet",
config={"api_path": "/greet", "http_method": "POST"}
)
result = await iii.trigger("greet", {"name": "world"})
print(result)
asyncio.run(main())
API
| Operation | Signature | Description |
|---|---|---|
| Initialize | init(url, options?) |
Create an SDK instance and auto-connect |
| Register function | iii.register_function(id, handler) |
Register a function that can be invoked by name |
| Register trigger | iii.register_trigger(type, function_id, config) |
Bind a trigger (HTTP, cron, queue, etc.) to a function |
| Invoke (await) | await iii.trigger(id, data) |
Invoke a function and wait for the result |
| Invoke (fire-and-forget) | iii.trigger_void(id, data) |
Invoke a function without waiting (fire-and-forget) |
init() must be called inside an async context. It creates the SDK instance and auto-connects to the engine.
Registering Functions
async def create_order(data):
return {"status_code": 201, "body": {"id": "123", "item": data["body"]["item"]}}
iii.register_function("orders.create", create_order)
Registering Triggers
iii.register_trigger(
type="http",
function_id="orders.create",
config={"api_path": "/orders", "http_method": "POST"}
)
Invoking Functions
result = await iii.trigger("orders.create", {"body": {"item": "widget"}})
iii.trigger_void("analytics.track", {"event": "page_view"})
Modules
| Import | What it provides |
|---|---|
iii |
Core SDK (III, types) |
iii.stream |
Stream client for real-time state |
iii.telemetry |
OpenTelemetry integration |
Development
Install in development mode
pip install -e .
Type checking
mypy src
Linting
ruff check src
Deprecated
call() and call_void() are deprecated aliases for trigger() and trigger_void(). They still work but will be removed in a future release.
Resources
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
iii_sdk-0.8.2.tar.gz
(151.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
iii_sdk-0.8.2-py3-none-any.whl
(31.5 kB
view details)
File details
Details for the file iii_sdk-0.8.2.tar.gz.
File metadata
- Download URL: iii_sdk-0.8.2.tar.gz
- Upload date:
- Size: 151.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
630d4ce9e21feec4a322caa4b3af3142dac2f2affaa1cbba0e847fbdd372fa0f
|
|
| MD5 |
b662295c3aa8930fdea1f675c113bef0
|
|
| BLAKE2b-256 |
b0b62acd982f8d72f30acd5c197890e0777ce3412be3acac1b240baf7063a339
|
File details
Details for the file iii_sdk-0.8.2-py3-none-any.whl.
File metadata
- Download URL: iii_sdk-0.8.2-py3-none-any.whl
- Upload date:
- Size: 31.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86b1c797cfcad87301f93393213c1741ad47edd2a0f1617e6ef9717e472e99a1
|
|
| MD5 |
1f44f860dfd7cbe076b35a813dfac388
|
|
| BLAKE2b-256 |
cfc92e04149e177418400303892f236576d6e70acc212423d2e692dd2defea44
|