apache-airflow-providers-modal

The modal provider owns the Airflow side of Modal credentials: the modal connection type and ModalHook, which turns that connection into an authenticated modal.Client.

What this provider is for

Modal’s SDK reads credentials from the worker’s environment (MODAL_TOKEN_ID / MODAL_TOKEN_SECRET) or from ~/.modal.toml. That works on a laptop and fails the moment two deployments need different tokens, a token lives in a secrets backend, or a task should run under a narrower token than the worker has. This provider gives Modal credentials the same home every other integration has, an Airflow connection, and one hook that every Modal-facing piece of Airflow code resolves it through:

  • ModalHook.get_function / get_cls return handles to deployed functions and classes; call .remote(), .spawn() or .map() on them as usual.

  • ModalHook.create_sandbox / get_sandbox create or reattach to a sandbox under a named app.

  • ModalHook.lookup_app, get_secret, get_volume resolve the other named resources.

  • ModalHook.client is the underlying modal.Client for anything not covered above; client_kwargs splats it into SDK calls that take only client=.

Every hook method applies both the connection’s credentials and its environment. Raw SDK calls made with client_kwargs carry the credentials only; see Using Modal from Airflow for what that means in practice.

The hook keeps working with no connection configured: it then defers to the Modal SDK’s own resolution, so a worker that already ran modal token new needs no Airflow setup. See Modal Connection for the full precedence rules.

apache-airflow-providers-modal package

Modal provider for Apache Airflow. Owns the modal connection type and a hook that turns it into an authenticated Modal client, so operators, toolsets and executors share one credential path.

Release: 0.1.0

Provider package

This package is for the modal provider. All classes for this package are included in the airflow.providers.modal python package.

Installation

You can install this package on top of an existing Airflow installation via pip install apache-airflow-providers-modal. For the minimum Airflow version supported, see Requirements below.

Requirements

The minimum Apache Airflow version supported by this provider distribution is 3.0.0.

PIP package

Version required

apache-airflow

>=3.0.0

apache-airflow-providers-common-compat

>=1.12.0

modal

>=1.5.0

Downloading official packages

You can download officially released packages and verify their checksums and signatures from the Official Apache Download site

Was this entry helpful?