1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 6 # build-system 7 setuptools, 8 setuptools-scm, 9 10 # optional dependencies 11 asgiref, 12 blinker, 13 django, 14 fastapi, 15 flask, 16 sanic, 17 18 # tests 19 django-redis, 20 pytest-django, 21 httpx, 22 fakeredis, 23 jsonschema, 24 pytestCheckHook, 25 pytest-cov-stub, 26 pytest-mock, 27 redis, 28 redisTestHook, 29}: 30 31buildPythonPackage rec { 32 pname = "dockerflow"; 33 version = "2024.04.2"; 34 pyproject = true; 35 36 src = fetchFromGitHub { 37 owner = "mozilla-services"; 38 repo = "python-dockerflow"; 39 tag = version; 40 hash = "sha256-5Ov605FyhX+n6vFks2sdtviGqkrgDIMXpcvgqR85jmQ="; 41 }; 42 43 build-system = [ 44 setuptools 45 setuptools-scm 46 ]; 47 48 optional-dependencies = { 49 django = [ django ]; 50 flask = [ 51 blinker 52 flask 53 ]; 54 sanic = [ sanic ]; 55 fastapi = [ 56 asgiref 57 fastapi 58 ]; 59 }; 60 61 nativeCheckInputs = [ 62 fakeredis 63 jsonschema 64 pytestCheckHook 65 pytest-cov-stub 66 pytest-mock 67 redis 68 redisTestHook 69 70 # django 71 django-redis 72 pytest-django 73 74 # fastapi 75 httpx 76 ] ++ lib.flatten (lib.attrValues optional-dependencies); 77 78 disabledTests = [ 79 # AssertionError: assert 'c7a05e2b-8a21-4255-a3ed-92cea1e74a62' is None 80 "test_mozlog_without_correlation_id_middleware" 81 ]; 82 83 disabledTestPaths = [ 84 # missing flask-redis dependency 85 "tests/flask/test_flask.py" 86 # missing sanic-redis dependency 87 "tests/sanic/test_sanic.py" 88 ]; 89 90 preCheck = '' 91 export DJANGO_SETTINGS_MODULE=tests.django.settings 92 ''; 93 94 pythonImportsCheck = [ 95 "dockerflow" 96 ]; 97 98 meta = { 99 changelog = "https://github.com/mozilla-services/python-dockerflow/releases/tag/${src.tag}"; 100 description = "A Python package to implement tools and helpers for Mozilla Dockerflow"; 101 homepage = "https://github.com/mozilla-services/python-dockerflow"; 102 license = lib.licenses.mpl20; 103 }; 104}