1{ lib 2, stdenv 3, buildPythonPackage 4, fetchFromGitHub 5, fetchpatch 6, aiofiles 7, anyio 8, contextlib2 9, itsdangerous 10, jinja2 11, python-multipart 12, pyyaml 13, requests 14, aiosqlite 15, databases 16, pytestCheckHook 17, pythonOlder 18, trio 19, typing-extensions 20, ApplicationServices 21}: 22 23buildPythonPackage rec { 24 pname = "starlette"; 25 version = "0.20.4"; 26 format = "setuptools"; 27 28 disabled = pythonOlder "3.6"; 29 30 src = fetchFromGitHub { 31 owner = "encode"; 32 repo = pname; 33 rev = "refs/tags/${version}"; 34 hash = "sha256-vP2TJPn9lRGnLGkO8lUmnsoT6rSnhuWDD3WqNk76SM0="; 35 }; 36 37 patches = [ 38 (fetchpatch { 39 url = "https://github.com/encode/starlette/commit/ab70211f0e1fb7390668bf4891eeceda8d9723a0.diff"; 40 excludes = [ "requirements.txt" ]; # conflicts 41 hash = "sha256-UHf4c4YUWp/1I1vD8J0hMewdlfkmluA+FyGf9ZsSv3Y="; 42 }) 43 ]; 44 45 postPatch = '' 46 # remove coverage arguments to pytest 47 sed -i '/--cov/d' setup.cfg 48 ''; 49 50 propagatedBuildInputs = [ 51 aiofiles 52 anyio 53 itsdangerous 54 jinja2 55 python-multipart 56 pyyaml 57 requests 58 ] ++ lib.optionals (pythonOlder "3.8") [ 59 typing-extensions 60 ] ++ lib.optionals (pythonOlder "3.7") [ 61 contextlib2 62 ] ++ lib.optionals stdenv.isDarwin [ 63 ApplicationServices 64 ]; 65 66 checkInputs = [ 67 aiosqlite 68 databases 69 pytestCheckHook 70 trio 71 typing-extensions 72 ]; 73 74 disabledTests = [ 75 # asserts fail due to inclusion of br in Accept-Encoding 76 "test_websocket_headers" 77 "test_request_headers" 78 ]; 79 80 pythonImportsCheck = [ 81 "starlette" 82 ]; 83 84 meta = with lib; { 85 homepage = "https://www.starlette.io/"; 86 description = "The little ASGI framework that shines"; 87 license = licenses.bsd3; 88 maintainers = with maintainers; [ wd15 ]; 89 }; 90}