Skip to main content

Type stubs for when Airflow is not installed

Project description

airflow-stubs

PyPI - Version


Table of Contents

Installation

pip install airflow-stubs

Introduction

This is not meant to improve the type hints of Airflow. Instead it's meant to offer some basic type hints when Airflow is not installed.

Lots of stuff is broken. Use at your own risk.

Motivation

Airflow has lots of dependencies. I want to be able to run it via Docker Compose as in simple-airflow without installing it in my project. I do however want to define DAGs in my project that use @task.docker. Installing the stubs alleviates some of the errors from not having Airflow installed in my environment.

Notes on regenerating

rm -rf dist
docker run -it --name generate-airflow-stubs -v "$(pwd)/generate-stubs-in-container.sh:/generate-stubs-in-container.sh:ro" apache/airflow bash /generate-stubs-in-container.sh
docker cp generate-airflow-stubs:/home/airflow/out/airflow .
docker rm generate-airflow-stubs
rm -rf airflow-stubs
mv airflow airflow-stubs
python -m build .

In order to render airflow.models.dag I had to patch get_members in mypy in order to retry on RuntimeError: dictionary changed size during iteration. (I used try: ... except RuntimeError: return self.get_members(obj).)

License

airflow-stubs is distributed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

airflow_stubs-0.0.1.tar.gz (129.5 kB view hashes)

Uploaded Source

Built Distribution

airflow_stubs-0.0.1-py3-none-any.whl (358.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page