diff --git a/pkgs/development/python-modules/genai-prices/default.nix b/pkgs/development/python-modules/genai-prices/default.nix index 7c58018d1233..c27015818d1d 100644 --- a/pkgs/development/python-modules/genai-prices/default.nix +++ b/pkgs/development/python-modules/genai-prices/default.nix @@ -7,20 +7,20 @@ uv-build, # dependencies - httpx, + httpx2, pydantic, }: buildPythonPackage (finalAttrs: { pname = "genai-prices"; - version = "0.0.61"; + version = "0.0.62"; pyproject = true; src = fetchFromGitHub { owner = "pydantic"; repo = "genai-prices"; tag = "v${finalAttrs.version}"; - hash = "sha256-3w3V6uIeRBTpc2rtkVRVsLlWGzHHksklv3YyCw6/VEI="; + hash = "sha256-VUhJwv15cHqIsZc103aoTX1D8kzt+cy/jdHUi++0+/w="; }; sourceRoot = "${finalAttrs.src.name}/packages/python"; @@ -30,7 +30,7 @@ buildPythonPackage (finalAttrs: { ]; dependencies = [ - httpx + httpx2 pydantic ]; diff --git a/pkgs/development/python-modules/httpcore2/default.nix b/pkgs/development/python-modules/httpcore2/default.nix new file mode 100644 index 000000000000..f7708b751017 --- /dev/null +++ b/pkgs/development/python-modules/httpcore2/default.nix @@ -0,0 +1,95 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + + # build-system + hatchling, + hatch-fancy-pypi-readme, + uv-dynamic-versioning, + + # dependencies + certifi, + h11, + + # optional dependencies + h2, + socksio, + trio, + anyio, + + # tests + pytestCheckHook, + pytest-httpbin, + pytest-trio, + + # reverse deps + httpx2, +}: + +buildPythonPackage (finalAttrs: { + pname = "httpcore2"; + version = "2.2.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "pydantic"; + repo = "httpx2"; + tag = "v${finalAttrs.version}"; + hash = "sha256-RdoMDF5XVOkb4JCmytdF0JmBfTUcHuM1N+SD8r+RNiU="; + }; + + postPatch = '' + pushd src/httpcore2 + ''; + + build-system = [ + hatchling + hatch-fancy-pypi-readme + uv-dynamic-versioning + ]; + + dependencies = [ + certifi + h11 + ]; + + optional-dependencies = { + asyncio = [ anyio ]; + http2 = [ h2 ]; + socks = [ socksio ]; + trio = [ trio ]; + }; + + pythonImportsCheck = [ + "httpcore2" + ]; + + preCheck = '' + popd + ''; + + nativeCheckInputs = [ + pytestCheckHook + pytest-httpbin + pytest-trio + ] + ++ lib.concatAttrValues finalAttrs.passthru.optional-dependencies; + + pytestFlags = [ "tests/httpcore2" ]; + + 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/httpcore2/CHANGELOG.md"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ hexa ]; + }; +}) diff --git a/pkgs/development/python-modules/httpx2/default.nix b/pkgs/development/python-modules/httpx2/default.nix new file mode 100644 index 000000000000..82f5a2acd0fd --- /dev/null +++ b/pkgs/development/python-modules/httpx2/default.nix @@ -0,0 +1,122 @@ +{ + 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, + zstandard, + + # tests + chardet, + pytestCheckHook, + pytest-httpbin, + pytest-trio, + trustme, + uvicorn, + + # reverse deps + httpx2, +}: + +buildPythonPackage (finalAttrs: { + pname = "httpx2"; + version = "2.2.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "pydantic"; + repo = "httpx2"; + tag = "v${finalAttrs.version}"; + hash = "sha256-RdoMDF5XVOkb4JCmytdF0JmBfTUcHuM1N+SD8r+RNiU="; + }; + + 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 ]; + zstd = lib.optionals (pythonOlder "3.14") [ zstandard ]; + }; + + pythonImportsCheck = [ + "httpx2" + ]; + + preCheck = '' + popd + ''; + + nativeCheckInputs = [ + chardet + pytestCheckHook + # pytest-httpbin + pytest-trio + trustme + uvicorn + ] + ++ lib.concatAttrValues finalAttrs.passthru.optional-dependencies; + + pytestFlags = [ "tests/httpx2" ]; + + disabledTests = [ + # network access + "test_async_proxy_close" + "test_sync_proxy_close" + ]; + + 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 ]; + }; +}) diff --git a/pkgs/development/python-modules/pydantic-ai-slim/default.nix b/pkgs/development/python-modules/pydantic-ai-slim/default.nix index a5848ca599fc..6e86318529ef 100644 --- a/pkgs/development/python-modules/pydantic-ai-slim/default.nix +++ b/pkgs/development/python-modules/pydantic-ai-slim/default.nix @@ -20,14 +20,14 @@ buildPythonPackage (finalAttrs: { pname = "pydantic-ai-slim"; - version = "1.102.0"; + version = "1.103.0"; pyproject = true; src = fetchFromGitHub { owner = "pydantic"; repo = "pydantic-ai"; tag = "v${finalAttrs.version}"; - hash = "sha256-5mX4o/LqiLAUmn1WXV6RVf2KwDYJ5pxFPtF2meVFp1o="; + hash = "sha256-eWusMERC1yZ/BltZPcYkrBGpbdG0EyWZVwYDqMLD/kY="; }; sourceRoot = "${finalAttrs.src.name}/pydantic_ai_slim"; diff --git a/pkgs/development/python-modules/pydantic-graph/default.nix b/pkgs/development/python-modules/pydantic-graph/default.nix index ae1f19129b20..0ff62acf21b6 100644 --- a/pkgs/development/python-modules/pydantic-graph/default.nix +++ b/pkgs/development/python-modules/pydantic-graph/default.nix @@ -16,14 +16,14 @@ buildPythonPackage (finalAttrs: { pname = "pydantic-graph"; - version = "1.102.0"; + version = "1.103.0"; pyproject = true; src = fetchFromGitHub { owner = "pydantic"; repo = "pydantic-ai"; tag = "v${finalAttrs.version}"; - hash = "sha256-5mX4o/LqiLAUmn1WXV6RVf2KwDYJ5pxFPtF2meVFp1o="; + hash = "sha256-eWusMERC1yZ/BltZPcYkrBGpbdG0EyWZVwYDqMLD/kY="; }; sourceRoot = "${finalAttrs.src.name}/pydantic_graph"; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 4ed1ce5b08d2..a18a31464372 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7299,6 +7299,8 @@ self: super: with self; { httpcore = callPackage ../development/python-modules/httpcore { }; + httpcore2 = callPackage ../development/python-modules/httpcore2 { }; + httpie = callPackage ../development/python-modules/httpie { }; httpie-ntlm = callPackage ../development/python-modules/httpie-ntlm { }; @@ -7333,6 +7335,8 @@ self: super: with self; { httpx-ws = callPackage ../development/python-modules/httpx-ws { }; + httpx2 = callPackage ../development/python-modules/httpx2 { }; + huawei-lte-api = callPackage ../development/python-modules/huawei-lte-api { }; hueble = callPackage ../development/python-modules/hueble { };