summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/httpcore/default.nix
blob: 5685bf9550e72e153452f61d9dcb4940d7ef016d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{
  lib,
  anyio,
  buildPythonPackage,
  certifi,
  fetchFromGitHub,
  hatchling,
  hatch-fancy-pypi-readme,
  h11,
  h2,
  pytest-httpbin,
  pytest-trio,
  pytestCheckHook,
  socksio,
  trio,
  # for passthru.tests
  httpx,
  httpx-socks,
  respx,
}:

buildPythonPackage rec {
  pname = "httpcore";
  version = "1.0.9";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "encode";
    repo = "httpcore";
    tag = version;
    hash = "sha256-YtAbx0iXN7u8pMBXQBUydvAH6ilH+veklvxSh5EVFXo=";
  };

  build-system = [
    hatchling
    hatch-fancy-pypi-readme
  ];

  dependencies = [
    certifi
    h11
  ];

  optional-dependencies = {
    asyncio = [ anyio ];
    http2 = [ h2 ];
    socks = [ socksio ];
    trio = [ trio ];
  };

  nativeCheckInputs = [
    pytest-httpbin
    pytest-trio
    pytestCheckHook
  ]
  ++ lib.concatAttrValues optional-dependencies;

  pythonImportsCheck = [ "httpcore" ];

  __darwinAllowLocalNetworking = true;

  passthru.tests = {
    inherit httpx httpx-socks respx;
  };

  meta = {
    changelog = "https://github.com/encode/httpcore/blob/${version}/CHANGELOG.md";
    description = "Minimal low-level HTTP client";
    homepage = "https://github.com/encode/httpcore";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ ris ];
  };
}