guix_mirror_bot pushed a commit to branch python-team
in repository guix.

commit 68ced6d3747c2416b998712ca579efeb1b513df1
Author: Sören Tempel <[email protected]>
AuthorDate: Tue Jan 6 11:02:41 2026 +0100

    gnu: python-numpy: Reduce closure size through custom wrap phase
    
    * gnu/packages/python-xyz.scm (python-numpy)
    [arguments] <phases>: Provide custom 'wrap phase.
    
    Change-Id: Iab5bbee198796b61364fc3116a748e0e71b79148
    Signed-off-by: Sharlatan Hellseher <[email protected]>
---
 gnu/packages/python-xyz.scm | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index f53529066d..0e13d256f5 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -10968,7 +10968,21 @@ include_dirs = ~:*~a/include~%" #$(this-package-input 
"openblas"))))))
             (lambda* (#:key tests? test-flags #:allow-other-keys)
               (when tests?
                 (with-directory-excursion #$output
-                  (apply invoke "pytest" test-flags))))))))
+                  (apply invoke "pytest" test-flags)))))
+          ;; The executables provided by this package ('f2py' and 
'numpy-config')
+          ;; only depend on Python.  By customizing the wrap phase we can 
ensure
+          ;; that we don't add all Python packages listed in native-inputs to
+          ;; the closure.  This significantly reduces the overall closure size.
+          ;;
+          ;; See also <https://bugs.gnu.org/25235>.
+          (replace 'wrap
+                   (lambda* (#:key inputs outputs #:allow-other-keys)
+                     (for-each
+                       (lambda (program)
+                         (wrap-program program
+                                       `("GUIX_PYTHONPATH" ":" suffix
+                                         ,(list (site-packages inputs 
outputs)))))
+                       (find-files (in-vicinity #$output "/bin"))))))))
     (native-inputs
      (list gfortran
            meson-python

Reply via email to