Python SDK

The Airplane Python SDK provides utilities to interact with the Airplane platform.

Installation

The Airplane Python SDK is available as a PyPI package, airplanesdk. To install it, run:
bash
Copied
1
$ pip install airplanesdk
There's another PyPI package called airplane (without the sdk prefix) that is completely unrelated to Airplane.dev.

Output

Tasks have Output that is rendered in the UI when executed. The simplest way to produce output is by returning it from the entrypoint of your task:
python
Copied
1
def main(params):
2
rows = query_db("...")
3
4
return {
5
"rows": rows,
6
"count": rows.length
7
}
This requires your task to buffer output in-memory before returning. Alternatively, output can be streamed while the task is executing using the Airplane SDK:
python
Copied
1
import airplane
2
3
def main(params):
4
rows = query_db("...")
5
6
for row in rows:
7
airplane.append_output(row, "rows")
8
9
airplane.set_output(rows.length, "count")
Both tasks produce the same output:
json
Copied
1
{
2
"rows": [
3
{ "name": "...", "age": 42 }
4
// ...
5
],
6
"count": 10
7
}