2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2021-07-14 22:03:04 +00:00
|
|
|
, python
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, alembic
|
2021-07-14 22:03:04 +00:00
|
|
|
, argcomplete
|
|
|
|
, attrs
|
|
|
|
, blinker
|
2020-04-24 23:36:52 +00:00
|
|
|
, cached-property
|
2021-07-14 22:03:04 +00:00
|
|
|
, cattrs
|
|
|
|
, clickclick
|
2020-04-24 23:36:52 +00:00
|
|
|
, colorlog
|
|
|
|
, croniter
|
2021-07-14 22:03:04 +00:00
|
|
|
, cryptography
|
2022-01-13 20:06:32 +00:00
|
|
|
, dataclasses
|
2020-04-24 23:36:52 +00:00
|
|
|
, dill
|
|
|
|
, flask
|
|
|
|
, flask_login
|
|
|
|
, flask_wtf
|
2022-01-13 20:06:32 +00:00
|
|
|
, flask-appbuilder
|
|
|
|
, flask-caching
|
2020-04-24 23:36:52 +00:00
|
|
|
, GitPython
|
2021-07-14 22:03:04 +00:00
|
|
|
, graphviz
|
2020-04-24 23:36:52 +00:00
|
|
|
, gunicorn
|
2021-07-14 22:03:04 +00:00
|
|
|
, httpx
|
2020-04-24 23:36:52 +00:00
|
|
|
, iso8601
|
2021-07-14 22:03:04 +00:00
|
|
|
, importlib-resources
|
|
|
|
, importlib-metadata
|
|
|
|
, inflection
|
|
|
|
, itsdangerous
|
2020-04-24 23:36:52 +00:00
|
|
|
, jinja2
|
2021-07-14 22:03:04 +00:00
|
|
|
, jsonschema
|
2020-04-24 23:36:52 +00:00
|
|
|
, lazy-object-proxy
|
2021-07-14 22:03:04 +00:00
|
|
|
, lockfile
|
2020-04-24 23:36:52 +00:00
|
|
|
, markdown
|
2021-07-14 22:03:04 +00:00
|
|
|
, markupsafe
|
|
|
|
, marshmallow-oneofschema
|
|
|
|
, numpy
|
|
|
|
, openapi-spec-validator
|
2020-04-24 23:36:52 +00:00
|
|
|
, pandas
|
|
|
|
, pendulum
|
|
|
|
, psutil
|
|
|
|
, pygments
|
2021-07-14 22:03:04 +00:00
|
|
|
, pyjwt
|
2020-04-24 23:36:52 +00:00
|
|
|
, python-daemon
|
|
|
|
, python-dateutil
|
2021-07-14 22:03:04 +00:00
|
|
|
, python-nvd3
|
|
|
|
, python-slugify
|
|
|
|
, python3-openid
|
2022-01-13 20:06:32 +00:00
|
|
|
, pythonOlder
|
2021-07-14 22:03:04 +00:00
|
|
|
, pyyaml
|
|
|
|
, rich
|
2020-04-24 23:36:52 +00:00
|
|
|
, setproctitle
|
|
|
|
, sqlalchemy
|
2021-07-14 22:03:04 +00:00
|
|
|
, sqlalchemy-jsonfield
|
|
|
|
, swagger-ui-bundle
|
2020-04-24 23:36:52 +00:00
|
|
|
, tabulate
|
|
|
|
, tenacity
|
|
|
|
, termcolor
|
|
|
|
, unicodecsv
|
2021-07-14 22:03:04 +00:00
|
|
|
, werkzeug
|
2021-12-06 16:07:01 +00:00
|
|
|
, pytestCheckHook
|
2021-07-14 22:03:04 +00:00
|
|
|
, freezegun
|
|
|
|
, mkYarnPackage
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
2021-07-14 22:03:04 +00:00
|
|
|
let
|
2022-04-15 01:41:22 +00:00
|
|
|
version = "2.2.4";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
airflow-src = fetchFromGitHub rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
owner = "apache";
|
|
|
|
repo = "airflow";
|
|
|
|
rev = version;
|
2022-04-15 01:41:22 +00:00
|
|
|
sha256 = "sha256-JCcEgCq1sB8lBaeJy7QQbWU00sGAh5vUmJAptF8M9qo=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
# airflow bundles a web interface, which is built using webpack by an undocumented shell script in airflow's source tree.
|
|
|
|
# This replicates this shell script, fixing bugs in yarn.lock and package.json
|
|
|
|
|
|
|
|
airflow-frontend = mkYarnPackage {
|
|
|
|
name = "airflow-frontend";
|
|
|
|
|
|
|
|
src = "${airflow-src}/airflow/www";
|
|
|
|
packageJSON = ./package.json;
|
|
|
|
yarnLock = ./yarn.lock;
|
|
|
|
yarnNix = ./yarn.nix;
|
|
|
|
|
|
|
|
distPhase = "true";
|
|
|
|
|
|
|
|
configurePhase = ''
|
|
|
|
cp -r $node_modules node_modules
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
yarn --offline build
|
|
|
|
find package.json yarn.lock static/css static/js -type f | sort | xargs md5sum > static/dist/sum.md5
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/static/
|
|
|
|
cp -r static/dist $out/static
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "apache-airflow";
|
|
|
|
inherit version;
|
|
|
|
src = airflow-src;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
disabled = pythonOlder "3.6";
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
alembic
|
2021-07-14 22:03:04 +00:00
|
|
|
argcomplete
|
|
|
|
attrs
|
|
|
|
blinker
|
2020-04-24 23:36:52 +00:00
|
|
|
cached-property
|
2021-07-14 22:03:04 +00:00
|
|
|
cattrs
|
|
|
|
clickclick
|
2020-04-24 23:36:52 +00:00
|
|
|
colorlog
|
|
|
|
croniter
|
2021-07-14 22:03:04 +00:00
|
|
|
cryptography
|
2020-04-24 23:36:52 +00:00
|
|
|
dill
|
|
|
|
flask
|
|
|
|
flask-appbuilder
|
|
|
|
flask-caching
|
|
|
|
flask_login
|
|
|
|
flask_wtf
|
|
|
|
GitPython
|
2021-07-14 22:03:04 +00:00
|
|
|
graphviz
|
2020-04-24 23:36:52 +00:00
|
|
|
gunicorn
|
2021-07-14 22:03:04 +00:00
|
|
|
httpx
|
2020-04-24 23:36:52 +00:00
|
|
|
iso8601
|
2021-07-14 22:03:04 +00:00
|
|
|
importlib-resources
|
|
|
|
inflection
|
|
|
|
itsdangerous
|
2020-04-24 23:36:52 +00:00
|
|
|
jinja2
|
2021-07-14 22:03:04 +00:00
|
|
|
jsonschema
|
2020-04-24 23:36:52 +00:00
|
|
|
lazy-object-proxy
|
2021-07-14 22:03:04 +00:00
|
|
|
lockfile
|
2020-04-24 23:36:52 +00:00
|
|
|
markdown
|
2021-07-14 22:03:04 +00:00
|
|
|
markupsafe
|
|
|
|
marshmallow-oneofschema
|
|
|
|
numpy
|
|
|
|
openapi-spec-validator
|
2020-04-24 23:36:52 +00:00
|
|
|
pandas
|
|
|
|
pendulum
|
|
|
|
psutil
|
|
|
|
pygments
|
2021-07-14 22:03:04 +00:00
|
|
|
pyjwt
|
2020-04-24 23:36:52 +00:00
|
|
|
python-daemon
|
|
|
|
python-dateutil
|
2021-07-14 22:03:04 +00:00
|
|
|
python-nvd3
|
|
|
|
python-slugify
|
|
|
|
python3-openid
|
|
|
|
pyyaml
|
|
|
|
rich
|
2020-04-24 23:36:52 +00:00
|
|
|
setproctitle
|
|
|
|
sqlalchemy
|
2021-07-14 22:03:04 +00:00
|
|
|
sqlalchemy-jsonfield
|
|
|
|
swagger-ui-bundle
|
2020-04-24 23:36:52 +00:00
|
|
|
tabulate
|
|
|
|
tenacity
|
|
|
|
termcolor
|
|
|
|
unicodecsv
|
2021-07-14 22:03:04 +00:00
|
|
|
werkzeug
|
2022-01-13 20:06:32 +00:00
|
|
|
] ++ lib.optionals (pythonOlder "3.7") [
|
|
|
|
dataclasses
|
|
|
|
] ++ lib.optionals (pythonOlder "3.9") [
|
|
|
|
importlib-metadata
|
2021-07-14 22:03:04 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
airflow-frontend
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [
|
2021-07-14 22:03:04 +00:00
|
|
|
freezegun
|
2021-12-06 16:07:01 +00:00
|
|
|
pytestCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
INSTALL_PROVIDERS_FROM_SOURCES = "true";
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postPatch = ''
|
2021-07-14 22:03:04 +00:00
|
|
|
substituteInPlace setup.cfg \
|
|
|
|
--replace "attrs>=20.0, <21.0" "attrs" \
|
|
|
|
--replace "cattrs~=1.1, <1.7.0" "cattrs" \
|
2022-01-13 20:06:32 +00:00
|
|
|
--replace "colorlog>=4.0.2, <6.0" "colorlog" \
|
|
|
|
--replace "croniter>=0.3.17, <1.1" "croniter" \
|
2021-07-14 22:03:04 +00:00
|
|
|
--replace "docutils<0.17" "docutils" \
|
2022-01-13 20:06:32 +00:00
|
|
|
--replace "flask-login>=0.3, <0.5" "flask-login" \
|
|
|
|
--replace "flask-wtf>=0.14.3, <0.15" "flask-wtf" \
|
|
|
|
--replace "flask>=1.1.0, <2.0" "flask" \
|
|
|
|
--replace "importlib_resources~=1.4" "importlib_resources" \
|
2021-10-11 16:52:03 +00:00
|
|
|
--replace "itsdangerous>=1.1.0, <2.0" "itsdangerous" \
|
2022-01-13 20:06:32 +00:00
|
|
|
--replace "markupsafe>=1.1.1, <2.0" "markupsafe" \
|
|
|
|
--replace "pyjwt<2" "pyjwt" \
|
2021-10-11 16:52:03 +00:00
|
|
|
--replace "python-slugify>=3.0.0,<5.0" "python-slugify" \
|
2022-01-13 20:06:32 +00:00
|
|
|
--replace "sqlalchemy_jsonfield~=1.0" "sqlalchemy-jsonfield" \
|
|
|
|
--replace "tenacity~=6.2.0" "tenacity" \
|
|
|
|
--replace "werkzeug~=1.0, >=1.0.1" "werkzeug"
|
2021-07-14 22:03:04 +00:00
|
|
|
|
|
|
|
substituteInPlace tests/core/test_core.py \
|
2020-04-24 23:36:52 +00:00
|
|
|
--replace "/bin/bash" "${stdenv.shell}"
|
2021-12-06 16:07:01 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
|
|
|
# Fix failing test on Hydra
|
|
|
|
substituteInPlace airflow/utils/db.py \
|
|
|
|
--replace "/tmp/sqlite_default.db" "$TMPDIR/sqlite_default.db"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
# allow for gunicorn processes to have access to Python packages
|
|
|
|
makeWrapperArgs = [
|
|
|
|
"--prefix PYTHONPATH : $PYTHONPATH"
|
|
|
|
];
|
2020-05-15 21:57:56 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
preCheck = ''
|
2022-01-13 20:06:32 +00:00
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
export AIRFLOW_HOME=$HOME
|
|
|
|
export AIRFLOW__CORE__UNIT_TEST_MODE=True
|
|
|
|
export AIRFLOW_DB="$HOME/airflow.db"
|
|
|
|
export PATH=$PATH:$out/bin
|
|
|
|
|
|
|
|
airflow version
|
|
|
|
airflow db init
|
|
|
|
airflow db reset -y
|
2021-07-14 22:03:04 +00:00
|
|
|
'';
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
pytestFlagsArray = [
|
|
|
|
"tests/core/test_core.py"
|
|
|
|
];
|
|
|
|
|
|
|
|
disabledTests = lib.optionals stdenv.isDarwin [
|
2022-01-13 20:06:32 +00:00
|
|
|
"bash_operator_kill" # psutil.AccessDenied
|
2021-12-06 16:07:01 +00:00
|
|
|
];
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
postInstall = ''
|
|
|
|
cp -rv ${airflow-frontend}/static/dist $out/lib/${python.libPrefix}/site-packages/airflow/www/static
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Programmatically author, schedule and monitor data pipelines";
|
2021-12-30 13:39:12 +00:00
|
|
|
homepage = "https://airflow.apache.org/";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
2020-06-18 07:06:33 +00:00
|
|
|
maintainers = with maintainers; [ bhipple costrouc ingenieroariel ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|