Subject: [bug#77541] [PATCH 08/38] gnu: python-pytensor: Update to 2.30.1.

From: Nicolas Graves <[email-masked]>
Date: Fri, 4 Apr 2025 21:16:40 +0200

* gnu/packages/python-science.scm (python-pytensor): Update to 2.30.1.
[arguments]{test-flags}: Use field.
{phases}: Remove 'check phase replacement. Add phase 'pre-check.
---
 gnu/packages/python-science.scm | 43 +++++++++++++++++----------------
 1 file changed, 22 insertions(+), 21 deletions(-)

diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm
index 49e46f7ff3..3bf266582d 100644
--- a/gnu/packages/python-science.scm
+++ b/gnu/packages/python-science.scm
@@ -2465,7 +2465,7 @@ (define-public python-xarray-schema
 (define-public python-pytensor
   (package
     (name "python-pytensor")
-    (version "2.18.1")
+    (version "2.30.1")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -2474,10 +2474,28 @@ (define-public python-pytensor
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "0qa0y13xfm6w7ry7gp0lv84c8blyg34a9ns7ynwqyhf9majq08s5"))))
+                "008ivcrab9j256mcrfrcd1xlkq5qicsx97wqaxaxwk1ynnmxdqbn"))))
     (build-system pyproject-build-system)
     (arguments
      (list
+      #:test-flags
+      #~(list ;; test_tensor_basic.py file requires JAX.
+         "--ignore" "tests/link/jax/test_tensor_basic.py"
+         ;; No module named 'pytensor.scan.scan_perform'
+         "--ignore" "pytensor/scan/scan_perform_ext.py"
+         ;; Skip benchmark tests.
+         "-k" (string-append
+               "not test_elemwise_speed"
+               " and not test_logsumexp_benchmark"
+               " and not test_fused_elemwise_benchmark"
+               " and not test_scan_multiple_output"
+               " and not test_vector_taps_benchmark"
+               " and not test_cython_performance")
+         ;; Skip computationally intensive tests.
+         "--ignore" "tests/scan/"
+         "--ignore" "tests/tensor/"
+         "--ignore" "tests/sandbox/"
+         "--ignore" "tests/sparse/sandbox/")
       #:phases
       #~(modify-phases %standard-phases
           ;; Replace version manually because pytensor uses
@@ -2499,27 +2517,10 @@ (define-public python-pytensor
               (substitute* "setup.py"
                 (("versioneer.get_version\\(\\)")
                  (string-append "\"" #$version "\"")))))
-          (replace 'check
+          (add-before 'check 'pre-check
             (lambda* (#:key tests? #:allow-other-keys)
               (when tests?
-                (setenv "HOME" "/tmp") ; required for most tests
-                ;; Test discovery fails, have to call pytest by hand.
-                ;; test_tensor_basic.py file requires JAX.
-                (invoke "python" "-m" "pytest" "-vv"
-                        "--ignore" "tests/link/jax/test_tensor_basic.py"
-                        ;; Skip benchmark tests.
-                        "-k" (string-append
-                              "not test_elemwise_speed"
-                              " and not test_logsumexp_benchmark"
-                              " and not test_fused_elemwise_benchmark"
-                              " and not test_scan_multiple_output"
-                              " and not test_vector_taps_benchmark"
-                              " and not test_cython_performance")
-                        ;; Skip computationally intensive tests.
-                        "--ignore" "tests/scan/"
-                        "--ignore" "tests/tensor/"
-                        "--ignore" "tests/sandbox/"
-                        "--ignore" "tests/sparse/sandbox/")))))))
+                (setenv "HOME" "/tmp"))))))) ; required for most tests
     (native-inputs (list python-cython
                          python-pytest
                          python-pytest-mock
-- 
2.49.0