at master 2.7 kB view raw
1{ 2 lib, 3 stdenv, 4 anyio, 5 brotli, 6 brotlicffi, 7 buildPythonPackage, 8 certifi, 9 chardet, 10 click, 11 fetchFromGitHub, 12 h2, 13 hatch-fancy-pypi-readme, 14 hatchling, 15 httpcore, 16 idna, 17 isPyPy, 18 multipart, 19 pygments, 20 python, 21 pythonOlder, 22 rich, 23 socksio, 24 pytestCheckHook, 25 pytest-asyncio, 26 pytest-trio, 27 trustme, 28 uvicorn, 29 zstandard, 30}: 31 32buildPythonPackage rec { 33 pname = "httpx"; 34 version = "0.28.1"; 35 pyproject = true; 36 37 disabled = pythonOlder "3.7"; 38 39 src = fetchFromGitHub { 40 owner = "encode"; 41 repo = "httpx"; 42 tag = version; 43 hash = "sha256-tB8uZm0kPRnmeOvsDdrkrHcMVIYfGanB4l/xHsTKpgE="; 44 }; 45 46 build-system = [ 47 hatch-fancy-pypi-readme 48 hatchling 49 ]; 50 51 dependencies = [ 52 anyio 53 certifi 54 httpcore 55 idna 56 ]; 57 58 optional-dependencies = { 59 brotli = if isPyPy then [ brotlicffi ] else [ brotli ]; 60 cli = [ 61 click 62 rich 63 pygments 64 ]; 65 http2 = [ h2 ]; 66 socks = [ socksio ]; 67 zstd = [ zstandard ]; 68 }; 69 70 # trustme uses pyopenssl 71 doCheck = !(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64); 72 73 nativeCheckInputs = [ 74 chardet 75 multipart 76 pytestCheckHook 77 pytest-asyncio 78 pytest-trio 79 trustme 80 uvicorn 81 ] 82 ++ lib.flatten (builtins.attrValues optional-dependencies); 83 84 # testsuite wants to find installed packages for testing entrypoint 85 preCheck = '' 86 export PYTHONPATH=$out/${python.sitePackages}:$PYTHONPATH 87 ''; 88 89 pytestFlags = [ 90 "-Wignore::DeprecationWarning" 91 "-Wignore::trio.TrioDeprecationWarning" 92 ]; 93 94 disabledTests = [ 95 # httpcore.ConnectError: [Errno 101] Network is unreachable 96 "test_connect_timeout" 97 # httpcore.ConnectError: [Errno -2] Name or service not known 98 "test_async_proxy_close" 99 "test_sync_proxy_close" 100 # ResourceWarning: Async generator 'httpx._content.ByteStream.__aiter__' was garbage collected before it had been exhausted. Surround its use in 'async with aclosing(...):' to ensure that it gets cleaned up as soon as you're done using it. 101 "test_write_timeout" # trio variant 102 ]; 103 104 disabledTestPaths = [ "tests/test_main.py" ]; 105 106 pythonImportsCheck = [ "httpx" ]; 107 108 __darwinAllowLocalNetworking = true; 109 110 # stdenv's fake SSL_CERT_FILE breaks default http transport constructor with: 111 # FileNotFoundError: [Errno 2] No such file or directory 112 setupHook = ./setup-hook.sh; 113 114 meta = with lib; { 115 changelog = "https://github.com/encode/httpx/blob/${src.rev}/CHANGELOG.md"; 116 description = "Next generation HTTP client"; 117 mainProgram = "httpx"; 118 homepage = "https://github.com/encode/httpx"; 119 license = licenses.bsd3; 120 maintainers = with maintainers; [ fab ]; 121 }; 122}