Type stubs for when Airflow is not installed
Project description
airflow-stubs
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for airflow_stubs-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0298d714ad5e03421a8ecbc341642f510a9f820bce0496c0d2ebf4b64e5bcb5b |
|
MD5 | 6955a2a93fa5f7c5d846adca6286e1d3 |
|
BLAKE2b-256 | 2bdd7c1ea1fdd8603147592e685fa186e941d65ccfeb5573cb44380390fb3bfd |