1{ lib
2, stdenv
3, buildPythonPackage
4, fetchPypi
5, pythonOlder
6, async-timeout
7, attrs
8, chardet
9, idna-ssl
10, multidict
11, typing-extensions
12, yarl
13, async_generator
14, brotlipy
15, freezegun
16, gunicorn
17, pytest-mock
18, pytest-xdist
19, pytestCheckHook
20, re-assert
21, trustme
22}:
23
24buildPythonPackage rec {
25 pname = "aiohttp";
26 version = "3.7.4.post0";
27 disabled = pythonOlder "3.6";
28
29 src = fetchPypi {
30 inherit pname version;
31 sha256 = "493d3299ebe5f5a7c66b9819eacdcfbbaaf1a8e84911ddffcdc48888497afecf";
32 };
33
34 postPatch = ''
35 substituteInPlace setup.cfg --replace " --cov=aiohttp" ""
36 '';
37
38 propagatedBuildInputs = [
39 async-timeout
40 attrs
41 chardet
42 multidict
43 typing-extensions
44 yarl
45 ] ++ lib.optionals (pythonOlder "3.7") [
46 idna-ssl
47 ];
48
49 checkInputs = [
50 async_generator
51 brotlipy
52 freezegun
53 gunicorn
54 pytest-mock
55 pytest-xdist
56 pytestCheckHook
57 re-assert
58 trustme
59 ];
60
61 pytestFlagsArray = [
62 "-n auto"
63 ];
64
65 disabledTests = [
66 # Disable tests that require network access
67 "test_mark_formdata_as_processed"
68 ] ++ lib.optionals stdenv.is32bit [
69 "test_cookiejar"
70 ] ++ lib.optionals stdenv.isDarwin [
71 "test_addresses" # https://github.com/aio-libs/aiohttp/issues/3572, remove >= v4.0.0
72 "test_close"
73 ];
74
75 __darwinAllowLocalNetworking = true;
76
77 # aiohttp in current folder shadows installed version
78 # Probably because we run `python -m pytest` instead of `pytest` in the hook.
79 preCheck = ''
80 cd tests
81 '';
82
83 meta = with lib; {
84 description = "Asynchronous HTTP Client/Server for Python and asyncio";
85 license = licenses.asl20;
86 homepage = "https://github.com/aio-libs/aiohttp";
87 maintainers = with maintainers; [ dotlambda ];
88 };
89}