about summary refs log tree commit diff
path: root/pkgs/development/python-modules/requests/default.nix
blob: a483d00695188c88b9fff9169736b923b5ec3376 (plain) (blame)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
{
  lib,
  stdenv,
  brotlicffi,
  buildPythonPackage,
  certifi,
  chardet,
  charset-normalizer,
  fetchPypi,
  idna,
  pysocks,
  pytest-mock,
  pytest-xdist,
  pytestCheckHook,
  pythonOlder,
  urllib3,
}:

buildPythonPackage rec {
  pname = "requests";
  version = "2.32.3";
  format = "setuptools";

  disabled = pythonOlder "3.7";

  __darwinAllowLocalNetworking = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-VTZUF3NOsYJVWQqf+euX6eHaho1MzWQCOZ6vaK8gp2A=";
  };

  dependencies = [
    brotlicffi
    certifi
    charset-normalizer
    idna
    urllib3
  ];

  optional-dependencies = {
    security = [ ];
    socks = [ pysocks ];
    use_chardet_on_py3 = [ chardet ];
  };

  nativeCheckInputs = [
    pytest-mock
    pytest-xdist
    pytestCheckHook
  ] ++ optional-dependencies.socks;

  disabledTests =
    [
      # Disable tests that require network access and use httpbin
      "requests.api.request"
      "requests.models.PreparedRequest"
      "requests.sessions.Session"
      "requests"
      "test_redirecting_to_bad_url"
      "test_requests_are_updated_each_time"
      "test_should_bypass_proxies_pass_only_hostname"
      "test_urllib3_pool_connection_closed"
      "test_urllib3_retries"
      "test_use_proxy_from_environment"
      "TestRequests"
      "TestTimeout"
    ]
    ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
      # Fatal Python error: Aborted
      "test_basic_response"
      "test_text_response"
    ];

  disabledTestPaths = lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
    # Fatal Python error: Aborted
    "tests/test_lowlevel.py"
  ];

  pythonImportsCheck = [ "requests" ];

  meta = with lib; {
    description = "HTTP library for Python";
    homepage = "http://docs.python-requests.org/";
    changelog = "https://github.com/psf/requests/blob/v${version}/HISTORY.md";
    license = licenses.asl20;
    maintainers = with maintainers; [ fab ];
  };
}