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