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.46.1"; 32 pyproject = true; 33 34 disabled = pythonOlder "3.8"; 35 36 src = fetchFromGitHub { 37 owner = "encode"; 38 repo = "starlette"; 39 tag = version; 40 hash = "sha256-X/lMo9HY/3NI/dxCS3enpSjHwbEdwQk6sQiAFIUi1JQ="; 41 }; 42 43 build-system = [ hatchling ]; 44 45 dependencies = [ anyio ] ++ lib.optionals (pythonOlder "3.10") [ typing-extensions ]; 46 47 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 optional-dependencies); 60 61 pytestFlagsArray = [ 62 "-W" 63 "ignore::DeprecationWarning" 64 "-W" 65 "ignore::trio.TrioDeprecationWarning" 66 "-W" 67 "ignore::ResourceWarning" # FIXME remove once test suite is fully compatible with anyio 4.4.0 68 ]; 69 70 pythonImportsCheck = [ "starlette" ]; 71 72 passthru.tests = { 73 inherit fastapi; 74 }; 75 76 meta = with lib; { 77 changelog = "https://www.starlette.io/release-notes/#${lib.replaceStrings [ "." ] [ "" ] version}"; 78 downloadPage = "https://github.com/encode/starlette"; 79 homepage = "https://www.starlette.io/"; 80 description = "Little ASGI framework that shines"; 81 license = licenses.bsd3; 82 maintainers = with maintainers; [ wd15 ]; 83 }; 84}