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.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
55 pytest-console-scripts
56 pytestCheckHook
57 vcrpy
58 ] ++ optional-dependencies.all;
59
60 optional-dependencies = {
61 all = [
62 aiohttp
63 botocore
64 httpx
65 requests
66 requests-toolbelt
67 urllib3
68 websockets
69 ];
70 aiohttp = [ aiohttp ];
71 httpx = [ httpx ];
72 requests = [
73 requests
74 requests-toolbelt
75 urllib3
76 ];
77 websockets = [ websockets ];
78 botocore = [ botocore ];
79 };
80
81 preCheck = ''
82 export PATH=$out/bin:$PATH
83 '';
84
85 pytestFlagsArray = [
86 "--asyncio-mode=auto"
87 "-m 'not online'"
88 ];
89
90 disabledTests = [
91 # Tests requires network access
92 "test_async_client_validation_fetch_schema_from_server_valid_query"
93 "test_execute_result_error"
94 "test_get_introspection_query_ast"
95 "test_header_query"
96 "test_hero_name_query"
97 "test_http_transport"
98 "test_named_query"
99 "test_query_with_variable"
100 ];
101
102 disabledTestPaths = [
103 # Exclude linter tests
104 "gql-checker/tests/test_flake8_linter.py"
105 "gql-checker/tests/test_pylama_linter.py"
106 "tests/test_httpx.py"
107 "tests/test_httpx_async.py"
108 ];
109
110 pythonImportsCheck = [ "gql" ];
111
112 __darwinAllowLocalNetworking = true;
113
114 meta = with lib; {
115 description = "GraphQL client in Python";
116 homepage = "https://github.com/graphql-python/gql";
117 changelog = "https://github.com/graphql-python/gql/releases/tag/${src.tag}";
118 license = licenses.mit;
119 maintainers = with maintainers; [ fab ];
120 mainProgram = "gql-cli";
121 };
122}