Managed isolated environments for Python

0.25.7 · active · verified Tue Apr 14

Isolate offers a pluggable end-to-end solution for building, managing, and using isolated environments (virtualenv, conda, remote, and more). While directly installable, its primary utility for most users is realized as an underlying component of the fal.ai platform, enabling serverless execution of Python functions with specified dependencies in isolated cloud environments. The current version is 0.25.7, and the project appears to have an active release cadence, with version 0.25.6 uploaded to PyPI in early April 2026.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how the `fal` library, which utilizes `isolate` internally, allows users to define and run Python functions in isolated environments with specified dependencies. The `@fal.function` decorator handles the environment setup, including dependency installation, making the underlying isolation seamless to the developer. Direct usage of the `isolate` library's API is not a common pattern for end-users.

import fal
import os

@fal.function(
    "virtualenv",
    requirements=["pyjokes"],
    # For authentication, fal_client typically picks up FAL_KEY from environment variables
    # or 'fal auth login'. For this example, we assume it's set.
    # For a runnable quickstart, replace os.environ.get with your actual key if testing locally
    # fal_client is not directly used here, but implicitly by fal.function for deployment.
)
def tell_joke() -> str:
    import pyjokes
    joke = pyjokes.get_joke()
    return joke

# To run this, you would typically use the fal CLI after saving to a file (e.g., my_app.py):
# fal run my_app.py::tell_joke
# The output would be the joke returned by the function, executed in an isolated environment.

# This code snippet demonstrates how 'fal' (which uses 'isolate' internally)
# enables running a Python function with specific dependencies in an isolated environment.
# Direct invocation of 'isolate' classes/functions is not a common user pattern.
print('Function defined. To run, use `fal run <filename>::tell_joke` after `pip install fal` and `fal auth login`.')

view raw JSON →