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.2
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.2.tar.gz | 19.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| anedya_sparks_runtime-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.1 kB
Release files / anedya_sparks_runtime-0.0.2.tar.gz
| Download URL | anedya_sparks_runtime-0.0.2.tar.gz |
|---|---|
| Size | 19.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
345dd1d514ad5de0d51ba1c1302a48d6ff1964d79eb6d176914b4ccd233605f3
|
|
BLAKE2b-256 checksum How to use checksums |
8070bff9fd5bc14f6a7999e5a958fba094dd71a476dcee04fdce86a592603a7c
|
| 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.2-py3-none-any.whl
| Download URL | anedya_sparks_runtime-0.0.2-py3-none-any.whl |
|---|---|
| Size | 20.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7413b0deb6d687c5af0d87f5c3a63faf46439a84bdccff07ee42f254a66e27ee
|
|
BLAKE2b-256 checksum How to use checksums |
2fcd055640796032ebf74dba5f19adf0f559b31c3eb71afafee86e5cc091d033
|
| 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}
|