Python SDK for Inngest
Actively maintained. Last release 4 weeks ago, commits in 8 of the last 26 weeks. A safe choice.
pip install inngest
Serverless event-driven queues, background jobs, and scheduled jobs for Python.
Add durable functions and workflows to any framework and platform.
Inngest Python SDK
Inngest's SDK adds durable functions to Python in a few lines of code. Using this SDK, you can write background jobs as step functions without new queueing infrastructure such as celery.
We currently support the following frameworks (but adding a new framework is easy!):
- DigitalOcean Functions
- Django (
>=5.0) - FastAPI (
>=0.110.0) - Flask (
>=3.0.0) - Tornado (
>=6.4)
Python 3.10 is the minimum version we support.
Getting started
Examples
💡 You can mix
asyncand non-asyncfunctions in the same app!
Basic (no steps)
This is a minimal example of an Inngest function:
import flask
import inngest.flask
import requests
inngest_client = inngest.Inngest(
app_id="flask_example",
is_production=False,
)
@inngest_client.create_function(
fn_id="find_person",
trigger=inngest.TriggerEvent(event="app/person.find"),
)
def fetch_person(ctx: inngest.ContextSync) -> dict:
person_id = ctx.event.data["person_id"]
res = requests.get(f"https://swapi.dev/api/people/{person_id}", verify=False)
return res.json()
app = flask.Flask(__name__)
# Register functions with the Inngest server
inngest.flask.serve(
app,
inngest_client,
[fetch_person],
)
app.run(port=8000)