Function compiles stateless Python functions into self-contained native binaries we call predictors.

These native binaries are implemented directly in low-level languages, and do not rely on the Python runtime (or any other managed runtime).

Compiling a Function

First, decorate your Python function with the compile decorator:

greeting.py
from fxn import compile

@compile(
    tag="@happy-co/greeting",
    description="Say a friendly greeting."
)
def greeting (name: str) -> str:
    return f"Hey there {name}!"

Next, use the Function CLI to compile the function:

# Compile the predictor
$ fxn compile greeting.py

Making a Prediction

Once compiled, the predictor can be used to make predictions across all our supported platforms and SDKs: