1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 6 # build-system 7 hatchling, 8 9 # dependencies 10 anyio, 11 typing-extensions, 12 13 # optional dependencies 14 itsdangerous, 15 jinja2, 16 python-multipart, 17 pyyaml, 18 httpx, 19 20 # tests 21 pytestCheckHook, 22 pythonOlder, 23 trio, 24 25 # reverse dependencies 26 fastapi, 27}: 28 29buildPythonPackage rec { 30 pname = "starlette"; 31 version = "0.37.2"; 32 pyproject = true; 33 34 disabled = pythonOlder "3.8"; 35 36 src = fetchFromGitHub { 37 owner = "encode"; 38 repo = "starlette"; 39 rev = "refs/tags/${version}"; 40 hash = "sha256-GiCN1sfhLu9i19d2OcLZrlY8E64DFrFh+ITRSvLaxdE="; 41 }; 42 43 nativeBuildInputs = [ hatchling ]; 44 45 propagatedBuildInputs = [ anyio ] ++ lib.optionals (pythonOlder "3.10") [ typing-extensions ]; 46 47 passthru.optional-dependencies.full = [ 48 itsdangerous 49 jinja2 50 python-multipart 51 pyyaml 52 httpx 53 ]; 54 55 nativeCheckInputs = [ 56 pytestCheckHook 57 trio 58 typing-extensions 59 ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies); 60 61 pytestFlagsArray = [ 62 "-W" 63 "ignore::DeprecationWarning" 64 "-W" 65 "ignore::trio.TrioDeprecationWarning" 66 ]; 67 68 pythonImportsCheck = [ "starlette" ]; 69 70 passthru.tests = { 71 inherit fastapi; 72 }; 73 74 meta = with lib; { 75 changelog = "https://www.starlette.io/release-notes/#${lib.replaceStrings [ "." ] [ "" ] version}"; 76 downloadPage = "https://github.com/encode/starlette"; 77 homepage = "https://www.starlette.io/"; 78 description = "The little ASGI framework that shines"; 79 license = licenses.bsd3; 80 maintainers = with maintainers; [ wd15 ]; 81 }; 82}