1{ lib
2, stdenv
3, buildPythonPackage
4, fetchPypi
5, pythonOlder
6# install_requires
7, attrs
8, charset-normalizer
9, multidict
10, async-timeout
11, yarl
12, frozenlist
13, aiosignal
14, aiodns
15, brotli
16, cchardet
17, asynctest
18, typing-extensions
19, idna-ssl
20# tests_require
21, async_generator
22, freezegun
23, gunicorn
24, pytest-mock
25, pytestCheckHook
26, re-assert
27, trustme
28}:
29
30buildPythonPackage rec {
31 pname = "aiohttp";
32 version = "3.8.0";
33 disabled = pythonOlder "3.6";
34
35 src = fetchPypi {
36 inherit pname version;
37 sha256 = "sha256-07GdjRg7z9aLJb7rq43DMIKC/iyj1uo8tM0QGzwnn40=";
38 };
39
40 postPatch = ''
41 sed -i '/--cov/d' setup.cfg
42 '';
43
44 propagatedBuildInputs = [
45 attrs
46 charset-normalizer
47 multidict
48 async-timeout
49 yarl
50 typing-extensions
51 frozenlist
52 aiosignal
53 aiodns
54 brotli
55 cchardet
56 ] ++ lib.optionals (pythonOlder "3.8") [
57 asynctest
58 typing-extensions
59 ] ++ lib.optionals (pythonOlder "3.7") [
60 idna-ssl
61 ];
62
63 checkInputs = [
64 async_generator
65 freezegun
66 gunicorn
67 pytest-mock
68 pytestCheckHook
69 re-assert
70 trustme
71 ];
72
73 disabledTests = [
74 # Disable tests that require network access
75 "test_client_session_timeout_zero"
76 "test_mark_formdata_as_processed"
77 "test_requote_redirect_url_default"
78 ] ++ lib.optionals stdenv.is32bit [
79 "test_cookiejar"
80 ] ++ lib.optionals stdenv.isDarwin [
81 "test_addresses" # https://github.com/aio-libs/aiohttp/issues/3572, remove >= v4.0.0
82 "test_close"
83 ];
84
85 disabledTestPaths = [
86 "test_proxy_functional.py" # FIXME package proxy.py
87 ];
88
89 __darwinAllowLocalNetworking = true;
90
91 # aiohttp in current folder shadows installed version
92 # Probably because we run `python -m pytest` instead of `pytest` in the hook.
93 preCheck = ''
94 cd tests
95 '';
96
97 meta = with lib; {
98 description = "Asynchronous HTTP Client/Server for Python and asyncio";
99 license = licenses.asl20;
100 homepage = "https://github.com/aio-libs/aiohttp";
101 maintainers = with maintainers; [ dotlambda ];
102 };
103}