Muna compiles stateless Python functions to run anywhere. This project is a playground for testing the Muna compiler. Over time, we expect to open-source more and more of the compiler infrastructure in this project.
First, install Muna for Python:
# Run this in Terminal
$ pip install --upgrade munaNext, head over to the Muna dashboard to generate an access key. Once generated, sign in to the CLI:
# Login to the Muna CLI
$ muna auth login <ACCESS KEY>The predictors directory contains several prediction functions, ranging from very simple functions to
AI inference with PyTorch. Internally, we use these functions to test language and library coverage in the compiler.
To compile a function, first update the predictor tag with your Muna username:
@compile(
tag="@username/some-function", # replace `username` with your Muna username
description="Compile a cool function."
)
def grader (score: float) -> str:
...Next, use the Muna CLI to compile the function, providing the path to the module where the function is defined:
# Compile the decorated function at the module path
$ muna compile --overwrite path/to/module.pyThe compiler will load the entrypoint function, create a remote sandbox, and compile the function:
Once you compile a function, you can download the generated C++ code:
# Retrieve the generated C++ source code for a given predictor
$ muna source --predictor @username/some-functionNote
Because our compiler can generate hundreds of implementations for a given predictor, we recommend
using muna source --prediction <id> to get the generated C++ code for a specific prediction. The
provided id must have been provided directly by our API.
Warning
The generated C++ code is provided for reference and cannot be compiled independently, as it depends on additional scaffolding provided by the Muna compiler toolchain.
- Discover predictors to use in your apps.
- Join our Slack community.
- Check out our docs.
- Learn more about us on our blog.
- Reach out to us at hi@muna.ai.
Muna is a product of NatML Inc.

