Something went wrong. Try again.
Nix Packages collection & NixOS github.com/NixOS/nixpkgs
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140{ stdenv, lib, buildPythonPackage, fetchFromGitHub, isPyPy, pythonOlder,
# build-system hatchling, hatch-fancy-pypi-readme, uv-dynamic-versioning,
# dependencies anyio, certifi, httpcore2, idna,
# optional dependencies brotli, brotlicffi, click, h2, pygments, rich, socksio, wsproto, zstandard,
# tests chardet, pytestCheckHook, pytest-trio, starlette, trustme, uvicorn, websockets,
# reverse deps httpx2,}:
buildPythonPackage (finalAttrs: { pname = "httpx2"; version = "2.13.1"; pyproject = true;
src = fetchFromGitHub { owner = "pydantic"; repo = "httpx2"; tag = "v${finalAttrs.version}"; hash = "sha256-XgjFiSwc4xCyPJcTB/Exh838fUOKsT0JRrha7s70C50="; };
postPatch = '' pushd src/httpx2 '';
build-system = [ hatchling hatch-fancy-pypi-readme uv-dynamic-versioning ];
dependencies = [ anyio certifi httpcore2 idna ];
optional-dependencies = { brotli = if isPyPy then [ brotlicffi ] else [ brotli ]; cli = [ click pygments rich ]; http2 = [ h2 ]; socks = [ socksio ]; ws = [ wsproto ]; zstd = lib.optionals (pythonOlder "3.14") [ zstandard ]; };
pythonImportsCheck = [ "httpx2" ];
preCheck = '' popd '';
nativeCheckInputs = [ chardet pytestCheckHook pytest-trio (starlette.overridePythonAttrs { doCheck = false; }) trustme uvicorn websockets ] ++ lib.concatAttrValues finalAttrs.passthru.optional-dependencies;
pytestFlags = [ "tests/httpx2" ];
disabledTests = [ # network access "test_async_proxy_close" "test_sync_proxy_close" "test_h2_timeout_during_request" # uvicorn access logging mismatch "test_logging_request" "test_logging_redirect_chain" # chardet shenanigans (Windows-1252 == WINDOWS-1252 cmp) "test_client_decode_text_using_autodetect" "test_client_decode_text_using_explicit_encoding" "test_response_decode_text_using_autodetect" ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ # TODO? "test_keepalive_ping" ];
passthru.tests = { inherit httpx2; };
__darwinAllowLocalNetworking = true; __structuredAttrs = true;
meta = { description = "A next generation HTTP client for Python"; homepage = "https://github.com/pydantic/httpx2"; changelog = "https://github.com/pydantic/httpx2/blob/${finalAttrs.src.tag}/src/httpx2/CHANGELOG.md"; license = lib.licenses.bsd3; maintainers = with lib.maintainers; [ hexa ]; };})