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