Load, Transform & Publish at Scale: Introducing the Hugging Face Provider for Apache Airflow

Community Article
Published November 13, 2026

image

Introduction

Datasets are a fundamental part of the machine learning lifecycle. From collection and preprocessing to sharing and consumption, managing them involves multiple steps that need to be repeatable and traceable.

Hugging Face provides an ecosystem for discovering, sharing and working with datasets. The Hugging Face Hub hosts 1M+ datasets, while the Datasets library offers a Python SDK for loading and processing them, with support for efficient transformations with Apache Arrow-backed storage and streaming.

Apache Airflow, on the other hand, is an open-source platform for authoring, scheduling and monitoring workflows. It allows developers to define pipelines as Python code using Directed Acyclic Graphs (DAGs), with tasks connected through explicit dependencies. Its scheduling, execution and monitoring capabilities make it well suited to coordinating data pipelines.

These two ecosystems address different parts of the same problem. Hugging Face provides the tools and infrastructure for working with data, while Airflow coordinates when and how those operations run. This is where apache-airflow-providers-huggingface comes in. To get started, install the provider with a source installation:

pip install "apache-airflow-providers-huggingface @ git+https://github.com/apache/airflow.git@main#subdirectory=providers/huggingface"

Bringing the Provider to the Airflow Community

Building the integration was only one part of the work. For the provider to become a sustainable part of the Apache Airflow ecosystem, it also needed input from the communities behind both projects. I started by opening a discussion in the Hugging Face Datasets repo: Hugging Face Datasets Provider for Apache Airflow #8882

Finding a path into Apache Airflow

The initial proposal outlined the motivation for a dedicated Airflow provider, covering dataset load_dataset(), .map() and push_to_hub() methods while feedback from the Airflow community added another dimension: Cache control for reproducible task retries, publishing events through Airflow assets and recording dataset revisions for provenance with XCom, with the initial release focused on Datasets while leaving room for additional integrations with HF Models and Inference Endpoints.

An important outcome of the Hugging Face discussion was the recommendation from Airflow PMC members to pursue inclusion directly in the Apache Airflow repository. Apache Airflow maintains an explicit process for accepting new community providers, documented in ACCEPTING_PROVIDERS.rst.

Taking the proposal to the Airflow developer list

With the initial implementation available, along with proposed stewards and a sponsoring committer, I opened the [DISCUSS] New Community Provider: Hugging Face thread on the Apache Airflow developer mailing list. The replies to it were warm and encouraging, with community members welcoming the integration and expressing interest in bringing Hugging Face capabilities into Airflow.

This response reinforced the value of the proposal and provided an opportunity to discuss its long-term direction within the project. Rather than remaining an independently maintained extension, it now had a path towards development under Airflow's established community governance model.

Designing and Working with the Provider

The apache-airflow-providers-huggingface provider brings Hugging Face Datasets operations into Apache Airflow through a set of operators, a dedicated connection and hook and integrations with Airflow's asset and lineage abstractions. Rather than introducing another abstraction over the Datasets library, the provider exposes familiar operations through Airflow's task execution model.

image

Out of the box, the provider offers four operators covering the primary dataset lifecycle:

  • LoadDatasetOperator: It wraps load_dataset(), exposing dataset selection, configuration, split, revision, download mode and caching options. The resulting dataset is persisted as an artifact and the task returns a reference containing its location, fingerprint, split information and source metadata.
  • MapDatasetOperator: The operator consumes an artifact reference and applies a user-defined callable through the Datasets map() method. The output is written as a new artifact with an updated fingerprint and compatible source metadata.
  • StreamDatasetOperator: With this operator, we can read data through IterableDataset, optionally apply transformations and publishes the resulting stream directly to the Hub, without materializing the entire dataset locally. This makes it particularly useful for processing large datasets with reduced storage overhead.
  • PushToHubOperator: This operator publishes a previously generated artifact to a Hub repository. Before publication, it verifies the artifact fingerprint and split checksums, reconstructs the dataset and invokes push_to_hub().

These operators are supported by the HuggingFaceHook, which centralizes connection handling and access to Hugging Face APIs. In this manner, the design follows a clear separation of responsibilities, with operators defining and orchestrating dataset operations, hooks managing connectivity to Hugging Face services while artifacts enabling the exchange of processed datasets between independently executed tasks. Together, these components provide a modular approach to executing and managing reproducible dataset pipelines within Apache Airflow.

Connecting Airflow to Hugging Face

Airflow connections provide a standard mechanism for configuring external credentials without embedding them in DAG definitions. The provider introduces a dedicated huggingface connection type, using the password field for the Hugging Face access token, displayed as Access token in the Airflow UI. Its default connection ID is huggingface_default, referenced by operators through the huggingface_conn_id parameter.

image

HuggingFaceHook centralizes access to Hugging Face services by initializing an HfApi client and exposing helpers for loading datasets, retrieving repository information and publishing to the Hub. When no explicit connection is configured, it can also use the Hugging Face SDK's ambient authentication, including HF_TOKEN or a cached worker login.

While operators define the individual dataset operations, their outputs also need to be exchanged reliably across task boundaries. The provider addresses this through an artifact-based approach built around XCom and Airflow's object storage abstractions.

Managing Artifacts and Lineage with the Provider

XCom is designed for lightweight metadata exchange between Airflow tasks. The provider builds on this mechanism through an artifact manifest that describes the dataset's storage location and associated metadata, including its format, split locations, row counts, feature definitions, column order and source metadata.

Tasks exchange this manifest through XCom, while the underlying dataset remains in durable storage. Furthermore, the provider uses Airflow's ObjectStoragePath abstraction to support both local filesystem paths and remote backends such as s3:// and gs://, subject to the corresponding storage integrations.

This separates task communication from artifact persistence, allowing independently executed tasks to exchange references to datasets without passing the underlying data through XCom. It also supports distributed pipelines across workers.

image

The provider also integrates with OpenLineage to represent Hugging Face repositories within Airflow's lineage ecosystem. The converter maps dataset assets to the https://huggingface.co namespace, providing a consistent external representation of datasets and their associated repositories. Combined with commit URLs, this metadata establishes traceability between Airflow executions and published Hub artifacts, supporting dataset reproducibility and lineage inspection across workflows.

Conclusion

The Hugging Face provider brings dataset operations into Airflow's orchestration model, enabling teams to build workflows around dataset loading, transformation and publication using familiar Airflow abstractions. By combining task-level orchestration with artifact-based data exchange, storage abstractions and lineage tracking, it provides a foundation for building reproducible and maintainable data pipelines at scale.

For data engineers, this means integrating dataset preparation into existing data workflows. ML engineers can orchestrate dataset transformations and publication alongside their broader machine learning pipelines, while platform teams gain a standardized interface for managing these operations within Airflow.

I would like to express my sincere gratitude to Quentin Lhoest from the Hugging Face Datasets team for his technical stewardship, thoughtful guidance and continued support throughout the provider's development. I am equally grateful to Kaxil Naik from the Apache Airflow team for sponsoring and championing the integration, providing invaluable guidance and helping bring the provider to the finish line. We also extend our appreciation to the wider Apache Airflow community for their feedback, collaboration and support. Their collective engagement has been instrumental in bringing this integration to fruition.

Community

๐Ÿš€๐Ÿš€๐Ÿš€

The retry-recovery detail is useful: clearing a task can re-emit the asset event without creating another Hub commit. That means publication recovery and downstream idempotency are separate concerns. I'd make the returned commit SHA prominent in the consumer example, so a repeated event can be recognized as the same dataset revision rather than a fresh data update.

Sign up or log in to comment