Serto Python SDK — write integrations in Python that run on the Serto platform
Project description
Serto Python SDK
pip install serto-sdk # distribution name; the import package is `serto`
Write Serto integrations in Python. An integration is any callable taking a Context:
# main.py
def handler(ctx):
ctx.logger.info(f"Running in {ctx.execution.environment}")
order = ctx.payload_json() # webhook/message body, parsed
api_key = ctx.secrets["API_KEY"] # provisioned secret
# ... do the work ...
ctx.publish("orders.synced", {"count": 42}) # message other integrations can subscribe to
Declare it in a serto.json next to your code:
{
"manifestVersion": "1",
"runtime": "python",
"integrations": [
{
"name": "Sync Orders",
"slug": "sync-orders",
"entrypoint": "main.py:handler",
"triggers": [{ "type": "scheduled", "cron": "0 * * * *" }],
"requiredSecrets": ["API_KEY"]
}
]
}
How it runs
The Serto agent launches python -m serto in your integration's directory, sends the invocation on
stdin, and reads structured events (logs, published messages, the result) from stdout. The protocol is
documented in docs/multi-language-runtimes.md. async def
handlers are supported.
The Context
| member | description |
|---|---|
ctx.logger |
.trace/.debug/.info/.warning/.error/.critical — captured into execution history |
ctx.secrets |
dict of secrets provisioned for the environment |
ctx.payload / ctx.payload_json() |
raw / parsed webhook or message body (None for scheduled) |
ctx.trigger |
how the run was triggered (ctx.trigger["type"] + source-specific fields) |
ctx.execution |
.execution_id, .integration_name, .environment, .scheduled_at, … |
ctx.publish(subject, body) |
publish a message; a non-string body is JSON-encoded |
Tests
cd sdks/python && python -m unittest discover -s tests
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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
File details
Details for the file serto_sdk-1.5.1.tar.gz.
File metadata
- Download URL: serto_sdk-1.5.1.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
47fa455349030ccb421ea43225665664cf7589fb2df8a00f7b44cc9b780f5538
|
|
| MD5 |
e0179ba9e5bb1e6c1b4f58416ca541d5
|
|
| BLAKE2b-256 |
3490b55977d5e7fc4d28f1bc661619c6b98038fc025f3303df4cc21af703bee4
|
Provenance
The following attestation bundles were made for serto_sdk-1.5.1.tar.gz:
Publisher:
publish.yml on neweyc/integration-platform
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
serto_sdk-1.5.1.tar.gz -
Subject digest:
47fa455349030ccb421ea43225665664cf7589fb2df8a00f7b44cc9b780f5538 - Sigstore transparency entry: 1795478382
- Sigstore integration time:
-
Permalink:
neweyc/integration-platform@ed17ebc8834bbccc332f67e8fe9b5002cad35c0c -
Branch / Tag:
refs/tags/v1.5.1 - Owner: https://github.com/neweyc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ed17ebc8834bbccc332f67e8fe9b5002cad35c0c -
Trigger Event:
push
-
Statement type:
File details
Details for the file serto_sdk-1.5.1-py3-none-any.whl.
File metadata
- Download URL: serto_sdk-1.5.1-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d3a1ffe8e3949285fc8f14d0b792ab6a7f97fcdc2f99e8267561c19c3eb1dc8
|
|
| MD5 |
46e2da3a770638bd91e60350a66e3778
|
|
| BLAKE2b-256 |
c552dd36abf0087d0aef4302cf22ebab22f1a4516e8dfedd5634b6d16563044d
|
Provenance
The following attestation bundles were made for serto_sdk-1.5.1-py3-none-any.whl:
Publisher:
publish.yml on neweyc/integration-platform
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
serto_sdk-1.5.1-py3-none-any.whl -
Subject digest:
0d3a1ffe8e3949285fc8f14d0b792ab6a7f97fcdc2f99e8267561c19c3eb1dc8 - Sigstore transparency entry: 1795478920
- Sigstore integration time:
-
Permalink:
neweyc/integration-platform@ed17ebc8834bbccc332f67e8fe9b5002cad35c0c -
Branch / Tag:
refs/tags/v1.5.1 - Owner: https://github.com/neweyc
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ed17ebc8834bbccc332f67e8fe9b5002cad35c0c -
Trigger Event:
push
-
Statement type: