1{ lib
2, aiohttp
3, asgiref
4, backports-cached-property
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, mypy
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.176.3";
46 format = "pyproject";
47
48 disabled = pythonOlder "3.7";
49
50 src = fetchFromGitHub {
51 owner = "strawberry-graphql";
52 repo = "strawberry";
53 rev = "refs/tags/${version}";
54 hash = "sha256-O57gCJiLlR3k45V6cRNd9AHo9EGoWd7WRMmnV/8xFyQ=";
55 };
56
57 patches = [
58 (fetchpatch {
59 name = "switch-to-poetry-core.patch";
60 url = "https://github.com/strawberry-graphql/strawberry/commit/710bb96f47c244e78fc54c921802bcdb48f5f421.patch";
61 hash = "sha256-ekUZ2hDPCqwXp9n0YjBikwSkhCmVKUzQk7LrPECcD7Y=";
62 })
63 ];
64
65 postPatch = ''
66 substituteInPlace pyproject.toml \
67 --replace " --emoji --mypy-ini-file=mypy.ini --benchmark-disable" "" \
68 '';
69
70 nativeBuildInputs = [
71 poetry-core
72 ];
73
74 propagatedBuildInputs = [
75 graphql-core
76 python-dateutil
77 typing-extensions
78 ];
79
80 passthru.optional-dependencies = {
81 aiohttp = [
82 aiohttp
83 pytest-aiohttp
84 ];
85 asgi = [
86 starlette
87 python-multipart
88 ];
89 debug = [
90 rich
91 libcst
92 ];
93 debug-server = [
94 click
95 libcst
96 pygments
97 python-multipart
98 rich
99 starlette
100 uvicorn
101 ];
102 django = [
103 django
104 pytest-django
105 asgiref
106 ];
107 channels = [
108 channels
109 asgiref
110 ];
111 flask = [
112 flask
113 pytest-flask
114 ];
115 # opentelemetry = [
116 # opentelemetry-api
117 # opentelemetry-sdk
118 # ];
119 pydantic = [
120 pydantic
121 ];
122 sanic = [
123 sanic
124 ];
125 fastapi = [
126 fastapi
127 python-multipart
128 ];
129 chalice = [
130 chalice
131 ];
132 cli = [
133 click
134 pygments
135 rich
136 libcst
137 ];
138 # starlite = [
139 # starlite
140 # ];
141 pyinstrument = [
142 pyinstrument
143 ];
144 };
145
146 nativeCheckInputs = [
147 daphne
148 email-validator
149 freezegun
150 mypy
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/schema/extensions/"
170 "tests/schema/test_dataloaders.py"
171 "tests/schema/test_lazy/"
172 "tests/starlite/"
173 "tests/test_dataloaders.py"
174 "tests/utils/test_pretty_print.py"
175 ];
176
177 meta = with lib; {
178 description = "A GraphQL library for Python that leverages type annotations";
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}