1{ 2 aiofile, 3 brotli, 4 brotlicffi, 5 buildPythonPackage, 6 fetchFromGitHub, 7 hatchling, 8 h11, 9 isPyPy, 10 jh2, 11 lib, 12 pytest-asyncio, 13 pytest-timeout, 14 pytestCheckHook, 15 python-socks, 16 pythonOlder, 17 qh3, 18 stdenv, 19 tornado, 20 trustme, 21 wsproto, 22 zstandard, 23}: 24 25buildPythonPackage rec { 26 pname = "urllib3-future"; 27 version = "2.14.901"; 28 pyproject = true; 29 30 src = fetchFromGitHub { 31 owner = "jawah"; 32 repo = "urllib3.future"; 33 tag = version; 34 hash = "sha256-WbOtW36UrJCliEI4TW+8+iOF8ZUJmuP0JqvsdrJkLlc="; 35 }; 36 37 postPatch = '' 38 substituteInPlace pyproject.toml \ 39 --replace-fail "''''ignore:.*but not measured.*:coverage.exceptions.CoverageWarning''''," "" \ 40 --replace-fail "''''ignore:.*No data was collected.*:coverage.exceptions.CoverageWarning''''," "" 41 ''; 42 43 build-system = [ hatchling ]; 44 45 # prevents installing a urllib3 module and thereby shadow the urllib3 package 46 env.URLLIB3_NO_OVERRIDE = "true"; 47 48 dependencies = [ 49 h11 50 jh2 51 qh3 52 ]; 53 54 optional-dependencies = { 55 brotli = [ (if isPyPy then brotlicffi else brotli) ]; 56 qh3 = [ qh3 ]; 57 secure = [ ]; 58 socks = [ python-socks ]; 59 ws = [ wsproto ]; 60 zstd = lib.optionals (pythonOlder "3.14") [ zstandard ]; 61 }; 62 63 pythonImportsCheck = [ "urllib3_future" ]; 64 65 # PermissionError: [Errno 1] Operation not permitted 66 doCheck = !stdenv.buildPlatform.isDarwin; 67 68 nativeCheckInputs = [ 69 aiofile 70 pytest-asyncio 71 pytest-timeout 72 pytestCheckHook 73 tornado 74 trustme 75 ] 76 ++ lib.flatten (lib.attrValues optional-dependencies); 77 78 disabledTestPaths = [ 79 # test connects to the internet 80 "test/contrib/test_resolver.py::test_url_resolver" 81 ]; 82 83 disabledTests = [ 84 # test hangs 85 "test_proxy_rejection" 86 ]; 87 88 meta = { 89 changelog = "https://github.com/jawah/urllib3.future/blob/${src.tag}/CHANGES.rst"; 90 description = "Powerful HTTP 1.1, 2, and 3 client with both sync and async interfaces"; 91 homepage = "https://github.com/jawah/urllib3.future"; 92 license = lib.licenses.mit; 93 maintainers = with lib.maintainers; [ dotlambda ]; 94 }; 95}