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