nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 109 lines 2.3 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 backports-zstd, 13 brotli, 14 brotlicffi, 15 h2, 16 pysocks, 17 18 # tests 19 httpx, 20 pyopenssl, 21 pytestCheckHook, 22 pytest-socket, 23 pytest-timeout, 24 quart, 25 quart-trio, 26 tornado, 27 trio, 28 trustme, 29}: 30 31let 32 self = buildPythonPackage rec { 33 pname = "urllib3"; 34 version = "2.6.3"; 35 pyproject = true; 36 37 src = fetchPypi { 38 inherit pname version; 39 hash = "sha256-G2K2iElEpX2+MhUJq5T9TTswcHXgwurpkaxx7hWtOO0="; 40 }; 41 42 build-system = [ 43 hatchling 44 hatch-vcs 45 ]; 46 47 postPatch = '' 48 substituteInPlace pyproject.toml \ 49 --replace-fail ', "setuptools-scm>=8,<10"' "" 50 ''; 51 52 optional-dependencies = { 53 brotli = if isPyPy then [ brotlicffi ] else [ brotli ]; 54 h2 = [ h2 ]; 55 socks = [ pysocks ]; 56 zstd = [ backports-zstd ]; 57 }; 58 59 nativeCheckInputs = [ 60 httpx 61 pyopenssl 62 pytest-socket 63 pytest-timeout 64 pytestCheckHook 65 quart 66 quart-trio 67 tornado 68 trio 69 trustme 70 ] 71 ++ lib.concatAttrValues optional-dependencies; 72 73 disabledTestMarks = [ 74 "requires_network" 75 ]; 76 77 # Tests in urllib3 are mostly timeout-based instead of event-based and 78 # are therefore inherently flaky. On your own machine, the tests will 79 # typically build fine, but on a loaded cluster such as Hydra random 80 # timeouts will occur. 81 # 82 # The urllib3 test suite has two different timeouts in their test suite 83 # (see `test/__init__.py`): 84 # - SHORT_TIMEOUT 85 # - LONG_TIMEOUT 86 # When CI is in the env, LONG_TIMEOUT will be significantly increased. 87 # Still, failures can occur and for that reason tests are disabled. 88 doCheck = false; 89 90 passthru.tests.pytest = self.overridePythonAttrs (_: { 91 doCheck = true; 92 }); 93 94 preCheck = '' 95 export CI # Increases LONG_TIMEOUT 96 ''; 97 98 pythonImportsCheck = [ "urllib3" ]; 99 100 meta = { 101 description = "Powerful, user-friendly HTTP client for Python"; 102 homepage = "https://github.com/urllib3/urllib3"; 103 changelog = "https://github.com/urllib3/urllib3/blob/${version}/CHANGES.rst"; 104 license = lib.licenses.mit; 105 maintainers = with lib.maintainers; [ fab ]; 106 }; 107 }; 108in 109self