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 = "gql";
37 tag = "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 = [
92 "--asyncio-mode=auto"
93 "-m 'not online'"
94 ];
95
96 disabledTests = [
97 # Tests requires network access
98 "test_async_client_validation_fetch_schema_from_server_valid_query"
99 "test_execute_result_error"
100 "test_get_introspection_query_ast"
101 "test_header_query"
102 "test_hero_name_query"
103 "test_http_transport"
104 "test_named_query"
105 "test_query_with_variable"
106 ];
107
108 disabledTestPaths = [
109 # Exclude linter tests
110 "gql-checker/tests/test_flake8_linter.py"
111 "gql-checker/tests/test_pylama_linter.py"
112 "tests/test_httpx.py"
113 "tests/test_httpx_async.py"
114 ];
115
116 pythonImportsCheck = [ "gql" ];
117
118 meta = with lib; {
119 description = "GraphQL client in Python";
120 homepage = "https://github.com/graphql-python/gql";
121 changelog = "https://github.com/graphql-python/gql/releases/tag/v${version}";
122 license = with licenses; [ mit ];
123 maintainers = with maintainers; [ fab ];
124 mainProgram = "gql-cli";
125 };
126}