Introducing Riza Custom Runtimes

We're Riza, and we make running untrusted code safe and easy. And now that code can use any Python or JavaScript package.

Over the past months we've heard from you that executing code with only a language's standard library isn't enough to power the applications you'd like to build. We listened.

We’re excited to announce Custom Runtimes, a feature that lets you execute code on Riza that uses any Python and JavaScript/TypeScript dependencies from PyPI and npm. For example, you can now use Riza to run Python code that uses pandas to transform and analyze data. Or, you can run JavaScript code that uses cheerio to transform or extract data from HTML.

You can create a Custom Runtime from the Riza Dashboard or via the API.

How it works

To create a Custom Runtime, you specify the full set of packages you want to make available to your code at execution time. We support declaring packages in common package manager configuration file formats like requirements.txt and package.json. See the documentation for Python and JavaScript/TypeScript for more details.

curl https://api.riza.io/v1/runtimes \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $RIZA_API_KEY" \
    --data-binary @- << EOF
{
  "name": "acme-corp-custom-runtime",
  "language": "python",
  "manifest_file": {
    "name": "requirements.txt",
    "contents": "pandas\nnumpy\nscipy\nscikit-learn"
  }
}
EOF

Riza then generates a build artifact called a Runtime Revision with the packages you requested, which takes about a minute. A Runtime Revision represents the state of your Custom Runtime at a point in time. You can use a Runtime Revision in any request to the Execute Code API Endpoint to run code in the context of your Custom Runtime.

curl https://api.riza.io/v1/execute \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $RIZA_API_KEY" \
    --data-binary @- << EOF
{
  "runtime_revision_id": "<the id of your runtime revision>",
  "code": "import pandas\n...",
  "stdin": "[1.7,2.1,3.3,8.4,9.6,10.8]"
}
EOF

You can update the dependencies for your Custom Runtime, but a Runtime Revision is immutable. When you edit your Custom Runtime, Riza generates a new Runtime Revision that contains the new dependencies. Your existing code can continue to use any previous Runtime Revision, allowing you to update dependencies independently from code.

For a more detailed walkthrough, check out our Custom Runtimes API integration guide.

Wrapping up

Custom Runtimes are available today for all Riza users.

Developers on the Hobby Plan can create up to ten Custom Runtimes. If you need more please get in touch to upgrade to a paid plan.

We can't wait to see what you'll build! As always, we'll be available in Discord or via email to answer questions and take feedback.

And if you're looking for something else to read, check out this post about Just-in-time Programming with Riza.