Function supports compiling a tiny-but-growing subset of Python language constructs. Below are requirements and guidelines for compiling a Python function with Function:

Function Signature

The prediction function must be a module-level function, and must have parameter and return type annotations:

from fxn import compile

@compile(...)
def greeting (name: str) -> str:
    return f"Hello {name}"

The prediction function must not have any variable-length positional or keyword arguments.

Function supports a fixed set of predictor input and output value types. Below are supported type annotations:

Function Body

The function body can contain arbitrary Python code. Given that the Function compiler is currently a proof of concept, it has limited coverage. Below is a list of Python language features that we either partially support, or do not support at all:

Over time the list of unsupported language features will shrink and eventually, will be empty.

Library Coverage

We are adding support for popular libraries, across tensor frameworks, scientific computing, and more:

If you need a specific library to be supported by the Function compiler, reach out to us.