Anedya Sparks Runtime SDK
Build Python functions for Anedya Sparks with this SDK. You write a handler for each invocation; the SDK connects to the Sparks runtime, delivers events, and returns your handler's result.
Project structure
Create a project with packages/ for the function's installed dependencies and src/ for your function. Use a separate local virtual environment for development. Sparks runs src/main.py as the entrypoint.
my-spark-function/
├── packages/ # Function dependencies included in the asset
├── src/
│ └── main.py # Required entrypoint
└── .venv/ # Local development environment; do not upload
Set up the environment from your project directory:
Use Python 3.13 or newer.
python -m venv .venv
source .venv/bin/activate
mkdir -p packages src
python -m pip install --target packages anedya-sparks-runtime
On Windows, activate the environment with .venv\Scripts\activate.
Write a function
Put this in src/main.py:
import json
import anedya.sparks_runtime as sparks
@sparks.handler
def handle(event: sparks.Event) -> str:
data = event.json_payload()
result = {"message": f"Hello, {data.get('name', 'Sparks')}!"}
return json.dumps(result)
sparks.run()
The handler receives one sparks.Event. Use event.json_payload() for a JSON payload, or inspect event.request_id, event.trigger_type, and other event fields. Return bytes, str, or None; strings are encoded by the SDK. Keep sparks.run() at the end of main.py: it starts the invocation loop and blocks while the function serves requests.
Package for upload
The setup command installs the SDK and its dependencies into packages/. Install additional function dependencies there with python -m pip install --target packages <package>. From the project directory, zip packages/ and src/; the local .venv/ is only for development and does not need to be included.
zip -r function.zip packages src
Upload function.zip as the function asset.
Metadata
Release files for anedya-sparks-runtime 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| anedya_sparks_runtime-0.0.3.tar.gz | 18.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| anedya_sparks_runtime-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.7 kB
Release files / anedya_sparks_runtime-0.0.3.tar.gz
| Download URL | anedya_sparks_runtime-0.0.3.tar.gz |
|---|---|
| Size | 18.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b97fcb2ad9908c2d1138f668eb109adcadf0360b1c1cd5f9ccc74f3019488266
|
|
BLAKE2b-256 checksum How to use checksums |
78d148f983122355421a9bf3fceda865448fbb7e34459b1a1b9b4764dd00d765
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / anedya_sparks_runtime-0.0.3-py3-none-any.whl
| Download URL | anedya_sparks_runtime-0.0.3-py3-none-any.whl |
|---|---|
| Size | 19.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
542a909a187df7a972fd0c496087e23b032d4f7ec05a5e3fd2674a7f6342d8f7
|
|
BLAKE2b-256 checksum How to use checksums |
ae598468b97d673fc461bbd5ba7c779ce03085c8a2ecc7ee85271c198555f42d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.19 {"installer":{"name":"uv","version":"0.12.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|