nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at r-updates 119 lines 2.6 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 rich, 22 socksio, 23 pytestCheckHook, 24 pytest-asyncio, 25 pytest-trio, 26 trustme, 27 uvicorn, 28 zstandard, 29}: 30 31buildPythonPackage rec { 32 pname = "httpx"; 33 version = "0.28.1"; 34 pyproject = true; 35 36 src = fetchFromGitHub { 37 owner = "encode"; 38 repo = "httpx"; 39 tag = version; 40 hash = "sha256-tB8uZm0kPRnmeOvsDdrkrHcMVIYfGanB4l/xHsTKpgE="; 41 }; 42 43 build-system = [ 44 hatch-fancy-pypi-readme 45 hatchling 46 ]; 47 48 dependencies = [ 49 anyio 50 certifi 51 httpcore 52 idna 53 ]; 54 55 optional-dependencies = { 56 brotli = if isPyPy then [ brotlicffi ] else [ brotli ]; 57 cli = [ 58 click 59 rich 60 pygments 61 ]; 62 http2 = [ h2 ]; 63 socks = [ socksio ]; 64 zstd = [ zstandard ]; 65 }; 66 67 # trustme uses pyopenssl 68 doCheck = !(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64); 69 70 nativeCheckInputs = [ 71 chardet 72 multipart 73 pytestCheckHook 74 pytest-asyncio 75 pytest-trio 76 trustme 77 uvicorn 78 ] 79 ++ lib.concatAttrValues optional-dependencies; 80 81 # testsuite wants to find installed packages for testing entrypoint 82 preCheck = '' 83 export PYTHONPATH=$out/${python.sitePackages}:$PYTHONPATH 84 ''; 85 86 pytestFlags = [ 87 "-Wignore::DeprecationWarning" 88 "-Wignore::trio.TrioDeprecationWarning" 89 ]; 90 91 disabledTests = [ 92 # httpcore.ConnectError: [Errno 101] Network is unreachable 93 "test_connect_timeout" 94 # httpcore.ConnectError: [Errno -2] Name or service not known 95 "test_async_proxy_close" 96 "test_sync_proxy_close" 97 # 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. 98 "test_write_timeout" # trio variant 99 ]; 100 101 disabledTestPaths = [ "tests/test_main.py" ]; 102 103 pythonImportsCheck = [ "httpx" ]; 104 105 __darwinAllowLocalNetworking = true; 106 107 # stdenv's fake SSL_CERT_FILE breaks default http transport constructor with: 108 # FileNotFoundError: [Errno 2] No such file or directory 109 setupHook = ./setup-hook.sh; 110 111 meta = { 112 changelog = "https://github.com/encode/httpx/blob/${src.rev}/CHANGELOG.md"; 113 description = "Next generation HTTP client"; 114 mainProgram = "httpx"; 115 homepage = "https://github.com/encode/httpx"; 116 license = lib.licenses.bsd3; 117 maintainers = with lib.maintainers; [ fab ]; 118 }; 119}