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_0,
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.3";
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-0mVMhJHlF6EZ3D9fuNrzkoHm9vIAKxbuajmUs1JL0HY=";
39 };
40
41 build-system = [ setuptools ];
42
43 dependencies = [
44 anyio
45 backoff
46 graphql-core
47 yarl
48 ];
49
50 nativeCheckInputs = [
51 aiofiles
52 mock
53 parse
54 pytest-asyncio_0
55 pytest-console-scripts
56 pytestCheckHook
57 vcrpy
58 ]
59 ++ optional-dependencies.all;
60
61 optional-dependencies = {
62 all = [
63 aiohttp
64 botocore
65 httpx
66 requests
67 requests-toolbelt
68 urllib3
69 websockets
70 ];
71 aiohttp = [ aiohttp ];
72 httpx = [ httpx ];
73 requests = [
74 requests
75 requests-toolbelt
76 urllib3
77 ];
78 websockets = [ websockets ];
79 botocore = [ botocore ];
80 };
81
82 preCheck = ''
83 export PATH=$out/bin:$PATH
84 '';
85
86 pytestFlags = [
87 "--asyncio-mode=auto"
88 ];
89
90 disabledTestMarks = [
91 "online"
92 ];
93
94 disabledTests = [
95 # Tests requires network access
96 "test_async_client_validation_fetch_schema_from_server_valid_query"
97 "test_execute_result_error"
98 "test_get_introspection_query_ast"
99 "test_header_query"
100 "test_hero_name_query"
101 "test_http_transport"
102 "test_named_query"
103 "test_query_with_variable"
104 ];
105
106 disabledTestPaths = [
107 # Exclude linter tests
108 "gql-checker/tests/test_flake8_linter.py"
109 "gql-checker/tests/test_pylama_linter.py"
110 "tests/test_httpx.py"
111 "tests/test_httpx_async.py"
112 ];
113
114 pythonImportsCheck = [ "gql" ];
115
116 __darwinAllowLocalNetworking = true;
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/${src.tag}";
122 license = licenses.mit;
123 maintainers = with maintainers; [ fab ];
124 mainProgram = "gql-cli";
125 };
126}