at 23.05-pre 2.1 kB view raw
1{ lib 2, stdenv 3, brotli 4, brotlicffi 5, buildPythonPackage 6, certifi 7, chardet 8, click 9, fetchFromGitHub 10, h2 11, httpcore 12, isPyPy 13, pygments 14, python 15, pythonOlder 16, rfc3986 17, rich 18, sniffio 19, socksio 20, pytestCheckHook 21, pytest-asyncio 22, pytest-trio 23, trustme 24, uvicorn 25}: 26 27buildPythonPackage rec { 28 pname = "httpx"; 29 version = "0.23.0"; 30 format = "setuptools"; 31 32 disabled = pythonOlder "3.7"; 33 34 src = fetchFromGitHub { 35 owner = "encode"; 36 repo = pname; 37 rev = version; 38 hash = "sha256-s11Yeizm3y3w5D6ACQ2wp/KJ0+1ALY/R71IlTP2pMC4="; 39 }; 40 41 propagatedBuildInputs = [ 42 certifi 43 httpcore 44 rfc3986 45 sniffio 46 ]; 47 48 passthru.optional-dependencies = { 49 http2 = [ 50 h2 51 ]; 52 socks = [ 53 socksio 54 ]; 55 brotli = if isPyPy then [ 56 brotlicffi 57 ] else [ 58 brotli 59 ]; 60 cli = [ 61 click 62 rich 63 pygments 64 ]; 65 }; 66 67 # trustme uses pyopenssl 68 doCheck = !(stdenv.isDarwin && stdenv.isAarch64); 69 70 checkInputs = [ 71 chardet 72 pytestCheckHook 73 pytest-asyncio 74 pytest-trio 75 trustme 76 uvicorn 77 ] ++ passthru.optional-dependencies.http2 78 ++ passthru.optional-dependencies.brotli 79 ++ passthru.optional-dependencies.socks; 80 81 postPatch = '' 82 substituteInPlace setup.py \ 83 --replace "rfc3986[idna2008]>=1.3,<2" "rfc3986>=1.3" 84 ''; 85 86 # testsuite wants to find installed packages for testing entrypoint 87 preCheck = '' 88 export PYTHONPATH=$out/${python.sitePackages}:$PYTHONPATH 89 ''; 90 91 pytestFlagsArray = [ 92 "-W" 93 "ignore::DeprecationWarning" 94 ]; 95 96 disabledTests = [ 97 # httpcore.ConnectError: [Errno 101] Network is unreachable 98 "test_connect_timeout" 99 # httpcore.ConnectError: [Errno -2] Name or service not known 100 "test_async_proxy_close" 101 "test_sync_proxy_close" 102 ]; 103 104 disabledTestPaths = [ 105 "tests/test_main.py" 106 ]; 107 108 pythonImportsCheck = [ 109 "httpx" 110 ]; 111 112 __darwinAllowLocalNetworking = true; 113 114 meta = with lib; { 115 description = "The next generation HTTP client"; 116 homepage = "https://github.com/encode/httpx"; 117 license = licenses.bsd3; 118 maintainers = with maintainers; [ costrouc fab ]; 119 }; 120}