1{
2 nodejs,
3 lib,
4 buildPythonPackage,
5 pythonOlder,
6 fetchFromGitHub,
7 poetry-core,
8 # install_requires
9 charset-normalizer,
10 h2,
11 onecache,
12 # test dependencies
13 asgiref,
14 black,
15 django,
16 click,
17 httpx,
18 proxy-py,
19 pytest-aiohttp,
20 pytest-asyncio,
21 pytest-cov-stub,
22 pytest-django,
23 pytest-mock,
24 pytest-sugar,
25 pytest-timeout,
26 uvicorn,
27 httptools,
28 typed-ast,
29 uvloop,
30 requests,
31 aiohttp,
32 aiodns,
33 pytestCheckHook,
34 stdenv,
35}:
36
37buildPythonPackage rec {
38 pname = "aiosonic";
39 version = "0.22.0";
40 pyproject = true;
41
42 disabled = pythonOlder "3.8";
43
44 __darwinAllowLocalNetworking = true;
45
46 src = fetchFromGitHub {
47 owner = "sonic182";
48 repo = "aiosonic";
49 tag = version;
50 hash = "sha256-wBYGiSTSRhi11uqTyGgF1YpnBVoDraCr2GKC8VkQEWc=";
51 };
52
53 postPatch = ''
54 substituteInPlace pytest.ini --replace-fail \
55 "addopts = --black " \
56 "addopts = "
57 '';
58
59 build-system = [ poetry-core ];
60
61 dependencies = [
62 charset-normalizer
63 onecache
64 h2
65 ];
66
67 nativeCheckInputs = [
68 aiohttp
69 aiodns
70 asgiref
71 black
72 django
73 click
74 httpx
75 proxy-py
76 pytest-aiohttp
77 pytest-asyncio
78 pytest-cov-stub
79 pytest-django
80 pytest-mock
81 pytest-sugar
82 pytest-timeout
83 uvicorn
84 httptools
85 typed-ast
86 uvloop
87 requests
88 pytestCheckHook
89 nodejs
90 ];
91
92 pythonImportsCheck = [ "aiosonic" ];
93
94 disabledTests =
95 lib.optionals stdenv.hostPlatform.isLinux [
96 # need network
97 "test_simple_get"
98 "test_get_python"
99 "test_post_http2"
100 "test_get_http2"
101 "test_method_lower"
102 "test_keep_alive_smart_pool"
103 "test_keep_alive_cyclic_pool"
104 "test_get_with_params"
105 "test_get_with_params_in_url"
106 "test_get_with_params_tuple"
107 "test_post_form_urlencoded"
108 "test_post_tuple_form_urlencoded"
109 "test_post_json"
110 "test_put_patch"
111 "test_delete"
112 "test_delete_2"
113 "test_get_keepalive"
114 "test_post_multipart_to_django"
115 "test_connect_timeout"
116 "test_read_timeout"
117 "test_timeouts_overriden"
118 "test_pool_acquire_timeout"
119 "test_simple_get_ssl"
120 "test_simple_get_ssl_ctx"
121 "test_simple_get_ssl_no_valid"
122 "test_get_chunked_response"
123 "test_get_chunked_response_and_not_read_it"
124 "test_read_chunks_by_text_method"
125 "test_get_body_gzip"
126 "test_get_body_deflate"
127 "test_post_chunked"
128 "test_close_connection"
129 "test_close_old_keeped_conn"
130 "test_get_redirect"
131 "test_max_redirects"
132 "test_get_image"
133 "test_get_image_chunked"
134 "test_get_with_cookies"
135 "test_proxy_request"
136 ]
137 ++ lib.optionals stdenv.hostPlatform.isDarwin [
138 # "FAILED tests/test_proxy.py::test_proxy_request - Exception: port 8865 never got active"
139 "test_proxy_request"
140 ];
141
142 meta = {
143 changelog = "https://github.com/sonic182/aiosonic/blob/${version}/CHANGELOG.md";
144 description = "Very fast Python asyncio http client";
145 license = lib.licenses.mit;
146 homepage = "https://github.com/sonic182/aiosonic";
147 maintainers = with lib.maintainers; [ geraldog ];
148 };
149}