From b130c102f291d712ccd4831b58b02fadc508eb35 Mon Sep 17 00:00:00 2001 From: Yueh-Shun Li Date: Wed, 10 Dec 2025 17:52:17 +0800 Subject: [PATCH] python3Packages.smolagents: split pytest checks to passthru.tests Reduce closure size by splitting tests, as the tests depends on optional-dependencies. --- .../python-modules/smolagents/default.nix | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/smolagents/default.nix b/pkgs/development/python-modules/smolagents/default.nix index 174d4313b5bee..f4c80566791ec 100644 --- a/pkgs/development/python-modules/smolagents/default.nix +++ b/pkgs/development/python-modules/smolagents/default.nix @@ -50,7 +50,7 @@ wikipedia-api, }: -buildPythonPackage rec { +(buildPythonPackage rec { pname = "smolagents"; version = "1.21.3"; pyproject = true; @@ -122,6 +122,11 @@ buildPythonPackage rec { # ]; }); + # Split install checks to `passthru.tests.pytest-check` + # as it depends on `optional-dependencies`, + # which contains huge stuff like the GUI library `python3Packages.gradio`. + doCheck = false; + nativeCheckInputs = [ ipython pytest-datadir @@ -179,4 +184,16 @@ buildPythonPackage rec { license = lib.licenses.asl20; maintainers = with lib.maintainers; [ fab ]; }; -} +}).overrideAttrs + ( + finalAttrs: previousAttrs: { + passthru = previousAttrs.passthru // { + tests = previousAttrs.passthru.tests or { } // { + pytest-check = finalAttrs.overrideAttrs { + # buildPythonPackage maps doCheck to doInstallCheck. + doInstallCheck = true; + }; + }; + }; + } + )