2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchPypi,
|
|
|
|
isPyPy,
|
2024-01-13 08:15:51 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# build-system
|
|
|
|
hatchling,
|
2024-01-13 08:15:51 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# optional-dependencies
|
|
|
|
brotli,
|
|
|
|
brotlicffi,
|
|
|
|
pysocks,
|
2024-01-13 08:15:51 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# tests
|
|
|
|
backports-zoneinfo,
|
|
|
|
pytestCheckHook,
|
|
|
|
pytest-timeout,
|
|
|
|
pythonOlder,
|
|
|
|
tornado,
|
|
|
|
trustme,
|
2021-03-19 17:17:44 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
let
|
|
|
|
self = buildPythonPackage rec {
|
|
|
|
pname = "urllib3";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "2.2.2";
|
2024-06-05 15:53:02 +00:00
|
|
|
pyproject = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2024-07-27 06:49:29 +00:00
|
|
|
hash = "sha256-3VBUhVSaelUoM9peYGNjnQ0XfATyO8OGTkHl3F9hIWg=";
|
2024-06-05 15:53:02 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs = [ hatchling ];
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
passthru.optional-dependencies = {
|
|
|
|
brotli = if isPyPy then [ brotlicffi ] else [ brotli ];
|
|
|
|
socks = [ pysocks ];
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs =
|
|
|
|
[
|
|
|
|
pytest-timeout
|
|
|
|
pytestCheckHook
|
|
|
|
tornado
|
|
|
|
trustme
|
|
|
|
]
|
|
|
|
++ lib.optionals (pythonOlder "3.9") [ backports-zoneinfo ]
|
|
|
|
++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# 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;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
passthru.tests.pytest = self.overridePythonAttrs (_: {
|
|
|
|
doCheck = true;
|
|
|
|
});
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
preCheck = ''
|
|
|
|
export CI # Increases LONG_TIMEOUT
|
|
|
|
'';
|
2021-03-19 17:17:44 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "urllib3" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Powerful, user-friendly HTTP client for Python";
|
|
|
|
homepage = "https://github.com/urllib3/urllib3";
|
|
|
|
changelog = "https://github.com/urllib3/urllib3/blob/${version}/CHANGES.rst";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ fab ];
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2024-06-05 15:53:02 +00:00
|
|
|
in
|
|
|
|
self
|