1{ lib
2, anyio
3, buildPythonPackage
4, certifi
5, fetchFromGitHub
6, h11
7, h2
8, pproxy
9, pytest-asyncio
10, pytest-httpbin
11, pytest-trio
12, pytestCheckHook
13, pythonOlder
14, sniffio
15, socksio
16}:
17
18buildPythonPackage rec {
19 pname = "httpcore";
20 version = "0.15.0";
21 format = "setuptools";
22
23 disabled = pythonOlder "3.7";
24
25 src = fetchFromGitHub {
26 owner = "encode";
27 repo = pname;
28 rev = version;
29 hash = "sha256-FF3Yzac9nkVcA5bHVOz2ymvOelSfJ0K6oU8UWpBDcmo=";
30 };
31
32 postPatch = ''
33 substituteInPlace setup.py \
34 --replace "h11>=0.11,<0.13" "h11>=0.11,<0.14"
35 '';
36
37 propagatedBuildInputs = [
38 anyio
39 certifi
40 h11
41 sniffio
42 ];
43
44 passthru.optional-dependencies = {
45 http2 = [
46 h2
47 ];
48 socks = [
49 socksio
50 ];
51 };
52
53 checkInputs = [
54 pproxy
55 pytest-asyncio
56 pytest-httpbin
57 pytest-trio
58 pytestCheckHook
59 ] ++ passthru.optional-dependencies.http2
60 ++ passthru.optional-dependencies.socks;
61
62 pythonImportsCheck = [
63 "httpcore"
64 ];
65
66 pytestFlagsArray = [
67 "--asyncio-mode=strict"
68 ];
69
70 meta = with lib; {
71 description = "A minimal low-level HTTP client";
72 homepage = "https://github.com/encode/httpcore";
73 license = licenses.bsd3;
74 maintainers = with maintainers; [ ris ];
75 };
76}