1{ lib
2, stdenv
3, buildPythonPackage
4, fetchPypi
5, pythonOlder
6, attrs
7, chardet
8, multidict
9, async-timeout
10, yarl
11, idna-ssl
12, typing-extensions
13, pytestrunner
14, pytestCheckHook
15, gunicorn
16, async_generator
17, pytest_xdist
18, pytestcov
19, pytest-mock
20, trustme
21, brotlipy
22, freezegun
23, isPy38
24}:
25
26buildPythonPackage rec {
27 pname = "aiohttp";
28 version = "3.6.2";
29 # https://github.com/aio-libs/aiohttp/issues/4525 python3.8 failures
30 disabled = pythonOlder "3.5";
31
32 src = fetchPypi {
33 inherit pname version;
34 sha256 = "09pkw6f1790prnrq0k8cqgnf1qy57ll8lpmc6kld09q7zw4vi6i5";
35 };
36
37 checkInputs = [
38 pytestrunner pytestCheckHook gunicorn async_generator pytest_xdist
39 pytest-mock pytestcov trustme brotlipy freezegun
40 ];
41
42 propagatedBuildInputs = [ attrs chardet multidict async-timeout yarl ]
43 ++ lib.optionals (pythonOlder "3.7") [ idna-ssl typing-extensions ];
44
45 disabledTests = [
46 # disable tests which attempt to do loopback connections
47 "get_valid_log_format_exc"
48 "test_access_logger_atoms"
49 "aiohttp_request_coroutine"
50 "server_close_keepalive_connection"
51 "connector"
52 "client_disconnect"
53 "handle_keepalive_on_closed_connection"
54 "proxy_https_bad_response"
55 "partially_applied_handler"
56 "middleware"
57 # no longer compatible with pytest>=6
58 "aiohttp_plugin_async_fixture"
59 ] ++ lib.optionals stdenv.is32bit [
60 "test_cookiejar"
61 ] ++ lib.optionals isPy38 [
62 # Python 3.8 https://github.com/aio-libs/aiohttp/issues/4525
63 "test_read_boundary_with_incomplete_chunk"
64 "test_read_incomplete_chunk"
65 "test_request_tracing_exception"
66 ] ++ lib.optionals stdenv.isDarwin [
67 "test_addresses" # https://github.com/aio-libs/aiohttp/issues/3572
68 "test_close"
69 ];
70
71 # aiohttp in current folder shadows installed version
72 # Probably because we run `python -m pytest` instead of `pytest` in the hook.
73 preCheck = ''
74 cd tests
75 '';
76
77 meta = with lib; {
78 description = "Asynchronous HTTP Client/Server for Python and asyncio";
79 license = licenses.asl20;
80 homepage = "https://github.com/aio-libs/aiohttp";
81 maintainers = with maintainers; [ dotlambda ];
82 };
83}