1{
2 lib,
3 aiofiles,
4 aiohttp,
5 anyio,
6 backoff,
7 botocore,
8 buildPythonPackage,
9 fetchFromGitHub,
10 graphql-core,
11 httpx,
12 mock,
13 parse,
14 pytest-asyncio,
15 pytest-console-scripts,
16 pytestCheckHook,
17 pythonOlder,
18 requests,
19 requests-toolbelt,
20 setuptools,
21 urllib3,
22 vcrpy,
23 websockets,
24 yarl,
25}:
26
27buildPythonPackage rec {
28 pname = "gql";
29 version = "3.5.0";
30 pyproject = true;
31
32 disabled = pythonOlder "3.7";
33
34 src = fetchFromGitHub {
35 owner = "graphql-python";
36 repo = pname;
37 rev = "refs/tags/v${version}";
38 hash = "sha256-jm0X+X8gQyQYn03gT14bdr79+Wd5KL9ryvrU/0VUtEU=";
39 };
40
41 postPatch = ''
42 substituteInPlace setup.py --replace \
43 "websockets>=10,<11;python_version>'3.6'" \
44 "websockets>=10,<12;python_version>'3.6'"
45 '';
46
47 build-system = [ setuptools ];
48
49 dependencies = [
50 anyio
51 backoff
52 graphql-core
53 yarl
54 ];
55
56 nativeCheckInputs = [
57 aiofiles
58 mock
59 parse
60 pytest-asyncio
61 pytest-console-scripts
62 pytestCheckHook
63 vcrpy
64 ] ++ optional-dependencies.all;
65
66 optional-dependencies = {
67 all = [
68 aiohttp
69 botocore
70 httpx
71 requests
72 requests-toolbelt
73 urllib3
74 websockets
75 ];
76 aiohttp = [ aiohttp ];
77 httpx = [ httpx ];
78 requests = [
79 requests
80 requests-toolbelt
81 urllib3
82 ];
83 websockets = [ websockets ];
84 botocore = [ botocore ];
85 };
86
87 preCheck = ''
88 export PATH=$out/bin:$PATH
89 '';
90
91 pytestFlagsArray = [ "--asyncio-mode=auto" ];
92
93 disabledTests = [
94 # Tests requires network access
95 "test_execute_result_error"
96 "test_http_transport"
97 ];
98
99 disabledTestPaths = [
100 # Exclude linter tests
101 "gql-checker/tests/test_flake8_linter.py"
102 "gql-checker/tests/test_pylama_linter.py"
103 # Tests require network access
104 "tests/custom_scalars/test_money.py"
105 "tests/test_aiohttp.py"
106 "tests/test_appsync_http.py"
107 "tests/test_appsync_websockets.py"
108 "tests/test_async_client_validation.py"
109 "tests/test_graphqlws_exceptions.py"
110 "tests/test_graphqlws_subscription.py"
111 "tests/test_phoenix_channel_exceptions.py"
112 "tests/test_phoenix_channel_exceptions.py"
113 "tests/test_phoenix_channel_query.py"
114 "tests/test_phoenix_channel_subscription.py"
115 "tests/test_requests.py"
116 "tests/test_websocket_exceptions.py"
117 "tests/test_websocket_query.py"
118 "tests/test_websocket_subscription.py"
119 ];
120
121 pythonImportsCheck = [ "gql" ];
122
123 meta = with lib; {
124 description = "GraphQL client in Python";
125 mainProgram = "gql-cli";
126 homepage = "https://github.com/graphql-python/gql";
127 changelog = "https://github.com/graphql-python/gql/releases/tag/v${version}";
128 license = with licenses; [ mit ];
129 maintainers = with maintainers; [ fab ];
130 };
131}