1{ lib
2, brotli
3, buildPythonPackage
4, cryptography
5, dateutil
6, fetchPypi
7, idna
8, isPy27
9, mock
10, pyopenssl
11, pysocks
12, pytest-freezegun
13, pytest-timeout
14, pytestCheckHook
15, pythonOlder
16, tornado
17, trustme
18}:
19
20buildPythonPackage rec {
21 pname = "urllib3";
22 version = "1.26.4";
23
24 src = fetchPypi {
25 inherit pname version;
26 sha256 = "0dw9w9bs3hmr5dp3r3h43jyzzb1g1046ag7lj8pqf58i4kvj3c77";
27 };
28
29 propagatedBuildInputs = [
30 brotli
31 pysocks
32 ] ++ lib.optionals isPy27 [
33 cryptography
34 idna
35 pyopenssl
36 ];
37
38 checkInputs = [
39 dateutil
40 mock
41 pytest-freezegun
42 pytest-timeout
43 pytestCheckHook
44 tornado
45 trustme
46 ];
47
48 # Tests in urllib3 are mostly timeout-based instead of event-based and
49 # are therefore inherently flaky. On your own machine, the tests will
50 # typically build fine, but on a loaded cluster such as Hydra random
51 # timeouts will occur.
52 #
53 # The urllib3 test suite has two different timeouts in their test suite
54 # (see `test/__init__.py`):
55 # - SHORT_TIMEOUT
56 # - LONG_TIMEOUT
57 # When CI is in the env, LONG_TIMEOUT will be significantly increased.
58 # Still, failures can occur and for that reason tests are disabled.
59 doCheck = false;
60
61 preCheck = ''
62 export CI # Increases LONG_TIMEOUT
63 '';
64
65 pythonImportsCheck = [ "urllib3" ];
66
67 meta = with lib; {
68 description = "Powerful, sanity-friendly HTTP client for Python";
69 homepage = "https://github.com/shazow/urllib3";
70 license = licenses.mit;
71 maintainers = with maintainers; [ fab ];
72 };
73}