about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/gql/default.nix
blob: 9827f8d5a71af08c75b6687ee65254080d2aad14 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
{ lib
, aiofiles
, aiohttp
, backoff
, botocore
, buildPythonPackage
, fetchFromGitHub
, graphql-core
, mock
, parse
, pytest-asyncio
, pytest-console-scripts
, pytestCheckHook
, pythonOlder
, requests
, requests-toolbelt
, urllib3
, vcrpy
, websockets
, yarl
}:

buildPythonPackage rec {
  pname = "gql";
  version = "3.4.1";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "graphql-python";
    repo = pname;
    rev = "refs/tags/v${version}";
    hash = "sha256-/uPaRju2AJCjMCfA29IKQ4Hu71RBu/Yz8jHwk9EE1Eg=";
  };

  postPatch = ''
    substituteInPlace setup.py --replace \
      "websockets>=10,<11;python_version>'3.6'" \
      "websockets>=10,<12;python_version>'3.6'"
  '';

  propagatedBuildInputs = [
    backoff
    graphql-core
    yarl
  ];

  nativeCheckInputs = [
    aiofiles
    mock
    parse
    pytest-asyncio
    pytest-console-scripts
    pytestCheckHook
    vcrpy
  ] ++ passthru.optional-dependencies.all;

  passthru.optional-dependencies = {
    all = [
      aiohttp
      botocore
      requests
      requests-toolbelt
      urllib3
      websockets
    ];
    aiohttp = [
      aiohttp
    ];
    requests = [
      requests
      requests-toolbelt
      urllib3
    ];
    websockets = [
      websockets
    ];
    botocore = [
      botocore
    ];
  };

  preCheck = ''
    export PATH=$out/bin:$PATH
  '';

  pytestFlagsArray = [
    "--asyncio-mode=auto"
  ];

  disabledTests = [
    # Tests requires network access
    "test_execute_result_error"
    "test_http_transport"
  ];

  disabledTestPaths = [
    # Exclude linter tests
    "gql-checker/tests/test_flake8_linter.py"
    "gql-checker/tests/test_pylama_linter.py"
    # Tests require network access
    "tests/custom_scalars/test_money.py"
    "tests/test_aiohttp.py"
    "tests/test_appsync_http.py"
    "tests/test_appsync_websockets.py"
    "tests/test_async_client_validation.py"
    "tests/test_graphqlws_exceptions.py"
    "tests/test_graphqlws_subscription.py"
    "tests/test_phoenix_channel_exceptions.py"
    "tests/test_phoenix_channel_exceptions.py"
    "tests/test_phoenix_channel_query.py"
    "tests/test_phoenix_channel_subscription.py"
    "tests/test_requests.py"
    "tests/test_websocket_exceptions.py"
    "tests/test_websocket_query.py"
    "tests/test_websocket_subscription.py"
  ];

  pythonImportsCheck = [
    "gql"
  ];

  meta = with lib; {
    description = "GraphQL client in Python";
    homepage = "https://github.com/graphql-python/gql";
    changelog = "https://github.com/graphql-python/gql/releases/tag/v${version}";
    license = with licenses; [ mit ];
    maintainers = with maintainers; [ fab ];
  };
}