1{ 2 lib, 3 aiohttp, 4 asgiref, 5 buildPythonPackage, 6 chalice, 7 channels, 8 click, 9 daphne, 10 django, 11 email-validator, 12 fastapi, 13 fetchFromGitHub, 14 fetchpatch, 15 flask, 16 freezegun, 17 graphql-core, 18 libcst, 19 opentelemetry-api, 20 opentelemetry-sdk, 21 poetry-core, 22 pydantic, 23 pygments, 24 pyinstrument, 25 pytest-aiohttp, 26 pytest-asyncio, 27 pytest-django, 28 pytest-emoji, 29 pytest-flask, 30 pytest-mock, 31 pytest-snapshot, 32 pytestCheckHook, 33 python-dateutil, 34 python-multipart, 35 pythonOlder, 36 rich, 37 sanic, 38 sanic-testing, 39 starlette, 40 typing-extensions, 41 uvicorn, 42}: 43 44buildPythonPackage rec { 45 pname = "strawberry-graphql"; 46 version = "0.219.2"; 47 format = "pyproject"; 48 49 disabled = pythonOlder "3.8"; 50 51 src = fetchFromGitHub { 52 owner = "strawberry-graphql"; 53 repo = "strawberry"; 54 rev = "refs/tags/${version}"; 55 hash = "sha256-uIUETjzuDnlQp6wM7uxyLRSMT5uyrXFrI9NilcjP0BU="; 56 }; 57 58 patches = [ 59 (fetchpatch { 60 # https://github.com/strawberry-graphql/strawberry/pull/2199 61 name = "switch-to-poetry-core.patch"; 62 url = "https://github.com/strawberry-graphql/strawberry/commit/710bb96f47c244e78fc54c921802bcdb48f5f421.patch"; 63 hash = "sha256-ekUZ2hDPCqwXp9n0YjBikwSkhCmVKUzQk7LrPECcD7Y="; 64 }) 65 (fetchpatch { 66 # https://github.com/strawberry-graphql/strawberry/pull/3255 67 name = "fix-tests-with-pydantic_2.patch"; 68 url = "https://github.com/strawberry-graphql/strawberry/commit/0a0dc284ee6d31d4e82ac7ff1ed9fea4dff39fa6.patch"; 69 hash = "sha256-LACWD7XA6YL/apJwhpx3LPCKxKUfa+XWyTLK+Zkxlaw="; 70 }) 71 ]; 72 73 postPatch = '' 74 substituteInPlace pyproject.toml \ 75 --replace "--emoji --mypy-ini-file=mypy.ini" "" \ 76 ''; 77 78 nativeBuildInputs = [ poetry-core ]; 79 80 propagatedBuildInputs = [ 81 graphql-core 82 python-dateutil 83 typing-extensions 84 ]; 85 86 passthru.optional-dependencies = { 87 aiohttp = [ 88 aiohttp 89 pytest-aiohttp 90 ]; 91 asgi = [ 92 starlette 93 python-multipart 94 ]; 95 debug = [ 96 rich 97 libcst 98 ]; 99 debug-server = [ 100 click 101 libcst 102 pygments 103 python-multipart 104 rich 105 starlette 106 uvicorn 107 ]; 108 django = [ 109 django 110 pytest-django 111 asgiref 112 ]; 113 channels = [ 114 channels 115 asgiref 116 ]; 117 flask = [ 118 flask 119 pytest-flask 120 ]; 121 opentelemetry = [ 122 opentelemetry-api 123 opentelemetry-sdk 124 ]; 125 pydantic = [ pydantic ]; 126 sanic = [ sanic ]; 127 fastapi = [ 128 fastapi 129 python-multipart 130 ]; 131 chalice = [ chalice ]; 132 cli = [ 133 click 134 pygments 135 rich 136 libcst 137 ]; 138 # starlite = [ 139 # starlite 140 # ]; 141 pyinstrument = [ pyinstrument ]; 142 }; 143 144 nativeCheckInputs = [ 145 daphne 146 email-validator 147 freezegun 148 pytest-asyncio 149 pytest-emoji 150 pytest-mock 151 pytest-snapshot 152 pytestCheckHook 153 sanic-testing 154 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies); 155 156 pythonImportsCheck = [ "strawberry" ]; 157 158 disabledTestPaths = [ 159 "tests/benchmarks/" 160 "tests/cli/" 161 "tests/django/test_dataloaders.py" 162 "tests/exceptions/" 163 "tests/http/" 164 "tests/mypy/test_plugin.py" # avoid dependency on mypy 165 "tests/schema/extensions/" 166 "tests/schema/test_dataloaders.py" 167 "tests/schema/test_lazy/" 168 "tests/starlite/" 169 "tests/test_dataloaders.py" 170 "tests/utils/test_pretty_print.py" 171 "tests/websockets/test_graphql_transport_ws.py" 172 ]; 173 174 __darwinAllowLocalNetworking = true; 175 176 meta = with lib; { 177 description = "A GraphQL library for Python that leverages type annotations"; 178 mainProgram = "strawberry"; 179 homepage = "https://strawberry.rocks"; 180 changelog = "https://github.com/strawberry-graphql/strawberry/blob/${version}/CHANGELOG.md"; 181 license = with licenses; [ mit ]; 182 maintainers = with maintainers; [ izorkin ]; 183 }; 184}