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