diff --git a/pkgs/development/python-modules/urllib3/2.nix b/pkgs/development/python-modules/urllib3/2.nix new file mode 100644 index 00000000000..b44993c71b2 --- /dev/null +++ b/pkgs/development/python-modules/urllib3/2.nix @@ -0,0 +1,74 @@ +{ lib +, stdenv +, brotli +, buildPythonPackage +, certifi +, cryptography +, dateutil +, fetchPypi +, idna +, mock +, pyopenssl +, pysocks +, pytest-freezegun +, pytest-timeout +, pytestCheckHook +, pythonOlder +, tornado +, trustme +}: + +buildPythonPackage rec { + pname = "urllib3"; + version = "1.26.2"; + + src = fetchPypi { + inherit pname version; + sha256 = "19188f96923873c92ccb987120ec4acaa12f0461fa9ce5d3d0772bc965a39e08"; + }; + + propagatedBuildInputs = [ + brotli + certifi + cryptography + idna + pyopenssl + pysocks + ]; + + checkInputs = [ + dateutil + mock + pytest-freezegun + pytest-timeout + pytestCheckHook + tornado + trustme + ]; + + # Tests in urllib3 are mostly timeout-based instead of event-based and + # are therefore inherently flaky. On your own machine, the tests will + # typically build fine, but on a loaded cluster such as Hydra random + # timeouts will occur. + # + # The urllib3 test suite has two different timeouts in their test suite + # (see `test/__init__.py`): + # - SHORT_TIMEOUT + # - LONG_TIMEOUT + # When CI is in the env, LONG_TIMEOUT will be significantly increased. + # Still, failures can occur and for that reason tests are disabled. + doCheck = false; + + preCheck = '' + export CI # Increases LONG_TIMEOUT + ''; + + pythonImportsCheck = [ "urllib3" ]; + + meta = with lib; { + description = "Powerful, sanity-friendly HTTP client for Python"; + homepage = "https://github.com/shazow/urllib3"; + license = licenses.mit; + maintainers = with maintainers; [ fab ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 7fa21d27541..6c4c0738a6d 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -8524,9 +8524,12 @@ in { urlgrabber = callPackage ../development/python-modules/urlgrabber { }; - urllib3 = callPackage ../development/python-modules/urllib3 { - pytestCheckHook = self.pytestCheckHook_6_1; - }; + urllib3 = if isPy3k then + callPackage ../development/python-modules/urllib3 { + pytestCheckHook = self.pytestCheckHook_6_1; + } + else + callPackage ../development/python-modules/urllib3/2.nix { }; urwid = callPackage ../development/python-modules/urwid { };