evcc: 0.131.4 -> 0.131.5
[NixPkgs.git] / pkgs / development / python-modules / urllib3 / default.nix
blob943bed05fb0240df95eeedef8bebe89cb1092108
2   lib,
3   buildPythonPackage,
4   fetchPypi,
5   isPyPy,
7   # build-system
8   hatchling,
9   hatch-vcs,
11   # optional-dependencies
12   brotli,
13   brotlicffi,
14   pysocks,
16   # tests
17   backports-zoneinfo,
18   pytestCheckHook,
19   pytest-timeout,
20   pythonOlder,
21   tornado,
22   trustme,
25 let
26   self = buildPythonPackage rec {
27     pname = "urllib3";
28     version = "2.2.3";
29     pyproject = true;
31     src = fetchPypi {
32       inherit pname version;
33       hash = "sha256-59gUqB2tgebK8uyf3tsoTsyccwdrYmVFR8xkzNyuJuk=";
34     };
36     build-system = [
37       hatchling
38       hatch-vcs
39     ];
41     optional-dependencies = {
42       brotli = if isPyPy then [ brotlicffi ] else [ brotli ];
43       socks = [ pysocks ];
44     };
46     nativeCheckInputs =
47       [
48         pytest-timeout
49         pytestCheckHook
50         tornado
51         trustme
52       ]
53       ++ lib.optionals (pythonOlder "3.9") [ backports-zoneinfo ]
54       ++ lib.flatten (builtins.attrValues optional-dependencies);
56     # Tests in urllib3 are mostly timeout-based instead of event-based and
57     # are therefore inherently flaky. On your own machine, the tests will
58     # typically build fine, but on a loaded cluster such as Hydra random
59     # timeouts will occur.
60     #
61     # The urllib3 test suite has two different timeouts in their test suite
62     # (see `test/__init__.py`):
63     # - SHORT_TIMEOUT
64     # - LONG_TIMEOUT
65     # When CI is in the env, LONG_TIMEOUT will be significantly increased.
66     # Still, failures can occur and for that reason tests are disabled.
67     doCheck = false;
69     passthru.tests.pytest = self.overridePythonAttrs (_: {
70       doCheck = true;
71     });
73     preCheck = ''
74       export CI # Increases LONG_TIMEOUT
75     '';
77     pythonImportsCheck = [ "urllib3" ];
79     meta = with lib; {
80       description = "Powerful, user-friendly HTTP client for Python";
81       homepage = "https://github.com/urllib3/urllib3";
82       changelog = "https://github.com/urllib3/urllib3/blob/${version}/CHANGES.rst";
83       license = licenses.mit;
84       maintainers = with maintainers; [ fab ];
85     };
86   };
88 self