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