Skip to main content

PyPI  Anedya Documentation

Logo

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

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for anedya-sparks-runtime 0.0.4
File Size Uploaded
anedya_sparks_runtime-0.0.4.tar.gz 17.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for anedya-sparks-runtime 0.0.4
File Interpreter ABI Platform
anedya_sparks_runtime-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 37.3 kB

Release files / anedya_sparks_runtime-0.0.4.tar.gz

Download URL anedya_sparks_runtime-0.0.4.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
66226305316836f5cde9a9ab19c182e9e067c23e7d2aa8a7643fbf5b78ad667d
BLAKE2b-256 checksum
How to use checksums
ddd9a67004189020c14e36cb8d4780aca09e7c525fb4563240b98fd0d967017f
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.4-py3-none-any.whl

Download URL anedya_sparks_runtime-0.0.4-py3-none-any.whl
Size 19.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
733da969f843314bd93c43fcbee1bead9a2494d741c7b379979b2a4ea5361a0f
BLAKE2b-256 checksum
How to use checksums
33031513a13072c3fdfa51af34d048f214df3d09c7c92ccd192d894d75b5c533
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 history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page