nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 certifi,
6 chardet,
7 charset-normalizer,
8 fetchFromGitHub,
9 idna,
10 pysocks,
11 pytest-mock,
12 pytest-xdist,
13 pytestCheckHook,
14 setuptools,
15 urllib3,
16}:
17
18buildPythonPackage rec {
19 pname = "requests";
20 version = "2.32.5";
21 pyproject = true;
22
23 __darwinAllowLocalNetworking = true;
24
25 src = fetchFromGitHub {
26 owner = "psf";
27 repo = "requests";
28 tag = "v${version}";
29 hash = "sha256-cEBalMFoYFaGG8M48k+OEBvzLegzrTNP1NxH2ljP6qg=";
30 };
31
32 build-system = [ setuptools ];
33
34 dependencies = [
35 certifi
36 charset-normalizer
37 idna
38 urllib3
39 ];
40
41 optional-dependencies = {
42 security = [ ];
43 socks = [ pysocks ];
44 use_chardet_on_py3 = [ chardet ];
45 };
46
47 nativeCheckInputs = [
48 pytest-mock
49 pytest-xdist
50 pytestCheckHook
51 ]
52 ++ optional-dependencies.socks;
53
54 disabledTests = [
55 # Disable tests that require network access and use httpbin
56 "requests.api.request"
57 "requests.models.PreparedRequest"
58 "requests.sessions.Session"
59 "requests"
60 "test_redirecting_to_bad_url"
61 "test_requests_are_updated_each_time"
62 "test_should_bypass_proxies_pass_only_hostname"
63 "test_urllib3_pool_connection_closed"
64 "test_urllib3_retries"
65 "test_use_proxy_from_environment"
66 "TestRequests"
67 "TestTimeout"
68 ]
69 ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
70 # Fatal Python error: Aborted
71 "test_basic_response"
72 "test_text_response"
73 ];
74
75 disabledTestPaths = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
76 # Fatal Python error: Aborted
77 "tests/test_lowlevel.py"
78 ];
79
80 pythonImportsCheck = [ "requests" ];
81
82 meta = {
83 description = "HTTP library for Python";
84 homepage = "http://docs.python-requests.org/";
85 changelog = "https://github.com/psf/requests/blob/v${version}/HISTORY.md";
86 license = lib.licenses.asl20;
87 maintainers = with lib.maintainers; [ fab ];
88 };
89}