fal is an easy-to-use Serverless Python Framework that enables developers to build, test, and deploy serverless applications and machine learning models on GPU-accelerated infrastructure. It offers a Python SDK for defining applications and a CLI for deployment and management. The library is actively maintained, with frequent releases, and is currently at version 1.72.1.
pip install falVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates defining a simple 'Hello World' serverless application using `fal.App` and the `@fal.endpoint` decorator. It highlights the basic structure for a deployable application. Local testing and deployment are typically handled via the `fal` CLI after installing the `fal` package and authenticating.
Use `pip install fal` for app development/deployment, `pip install fal-client` for calling APIs. Import `fal` for app definition and `fal_client` for client interactions.
Run `fal auth login` in your terminal. For client SDK usage, ensure `export FAL_KEY="your-api-key-here"` is set in your environment or provide `api_key` argument to client constructors.
Implement a `teardown()` method in your `fal.App` class to handle graceful cleanup within the 5-second grace period.
Execute `fal run your_app.py::MyApp --auth private` to enforce private authentication during local testing.
Update any integrations that consume runner state information to correctly handle the new `IDLE` state. Refer to the 'Understanding Runners' guide in the fal documentation.
Install the Fal CLI using pip: `pip install fal`. If already installed, ensure your system's PATH includes the directory where pip installs executables.
Authenticate interactively using `fal auth login` in your terminal. Alternatively, set your API key as an environment variable: `export FAL_KEY="your-api-key-here"` (replace with your actual API key from the Fal dashboard).
Install the necessary Fal Python package using pip: `pip install fal` or `pip install fal-client` if you are only using the client SDK.
Carefully review your `requirements.txt` file for typos, ensure all package versions are compatible and explicitly pinned (e.g., `package==1.0.0`), and verify that all specified packages are available on PyPI or the specified alternative index.