Subject: [bug#76835] [PATCH v3 38/40] gnu: snakemake-7: Move to (gnu packages python-science).

From: Nicolas Graves <[email-masked]>
Date: Mon, 10 Mar 2025 03:16:43 +0100

* gnu/packages/python-xyz.scm (snakemake-7): Move from here…
* gnu/packages/python-science.scm (snakemake-7): …to here.
Inherit from snakemake@8.
---
 gnu/packages/python-science.scm |  70 +++++++++++++++++++++
 gnu/packages/python-xyz.scm     | 104 --------------------------------
 2 files changed, 70 insertions(+), 104 deletions(-)

diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm
index 7ccd991478..5acead6523 100644
--- a/gnu/packages/python-science.scm
+++ b/gnu/packages/python-science.scm
@@ -4532,6 +4532,76 @@ (define-public snakemake
 Python style, together with a fast and comfortable execution environment.")
     (license license:expat)))
 
+(define-public snakemake-7
+  (package
+    (inherit snakemake)
+    (name "snakemake")
+    (version "7.7.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/snakemake/snakemake")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1qrqbmx4cbis0wxr6dl2rdjv9v627sbirsz6v5c31vlbqwkvs04q"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (substitute-keyword-arguments (package-arguments snakemake)
+       ((#:test-flags test-flags)
+        #~(list
+           ;; We don't care about lints.
+           "--ignore=tests/test_linting.py"
+           ;; These tests attempt to change S3 buckets on AWS and fail
+           ;; because there are no AWS credentials.
+           "--ignore=tests/test_tibanna.py"
+           ;; It's a similar story with this test, which requires access
+           ;; to the Google Storage service.
+           "--ignore=tests/test_google_lifesciences.py"))
+       ((#:phases phases)
+        #~(modify-phases #$phases
+            (delete 'avoid-assets-download)
+            ;; No longer needed with 7.15.2+
+            (add-after 'unpack 'tabulate-compatibility
+              (lambda _
+                (substitute* "snakemake/dag.py"
+                  (("\"job\": rule,")
+                   "\"job\": rule.name,"))))))))
+    (propagated-inputs
+     (list python-appdirs
+           python-configargparse
+           python-connection-pool
+           python-datrie
+           python-docutils
+           python-filelock
+           python-gitpython
+           python-jinja2
+           python-jsonschema
+           python-nbformat
+           python-networkx
+           python-psutil
+           python-pulp
+           python-pyyaml
+           python-py-tes
+           python-ratelimiter
+           python-requests
+           python-retry
+           python-smart-open
+           python-stopit
+           python-tabulate
+           python-toposort
+           python-wrapt
+           python-yte))
+    (native-inputs
+     (list git-minimal
+           python-wrapper
+           python-pytest
+           python-pandas
+           python-requests-mock
+           python-setuptools
+           python-wheel))))
+
 ;;;
 ;;; Avoid adding new packages to the end of this file. To reduce the chances
 ;;; of a merge conflict, place them above by existing packages with similar
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 81b8386049..740e6cfd33 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -15082,110 +15082,6 @@ (define-public snakemake-6
            python-setuptools
            python-wheel))))
 
-(define-public snakemake-7
-  (package
-    (inherit snakemake-6)
-    (name "snakemake")
-    (version "7.7.0")
-    (source
-     (origin
-       (method git-fetch)
-       (uri (git-reference
-             (url "https://github.com/snakemake/snakemake")
-             (commit (string-append "v" version))))
-       (file-name (git-file-name name version))
-       (sha256
-        (base32 "1qrqbmx4cbis0wxr6dl2rdjv9v627sbirsz6v5c31vlbqwkvs04q"))))
-    (build-system pyproject-build-system)
-    (arguments
-     (list
-      #:phases
-      #~(modify-phases %standard-phases
-          ;; For cluster execution Snakemake will call Python.  Since there is
-          ;; no suitable GUIX_PYTHONPATH set, cluster execution will fail.  We
-          ;; fix this by calling the snakemake wrapper instead.
-          (add-after 'unpack 'call-wrapper-not-wrapped-snakemake
-            (lambda* (#:key outputs #:allow-other-keys)
-              (substitute* "snakemake/executors/__init__.py"
-                (("self\\.get_python_executable\\(\\),")
-                 "")
-                (("\"-m snakemake\"")
-                 (string-append "\"" #$output
-                                "/bin/snakemake" "\""))
-                ;; The snakemake command produced by format_job_exec contains
-                ;; references to /gnu/store.  Prior to patching above that's
-                ;; just a reference to Python; after patching it's a reference
-                ;; to the snakemake executable.
-                ;;
-                ;; In Tibanna execution mode Snakemake arranges for a certain
-                ;; Docker image to be deployed to AWS.  It then passes its own
-                ;; command line to Tibanna.  This is misguided because it only
-                ;; ever works if the local Snakemake command was run inside
-                ;; the same Docker image.  In the case of using Guix this is
-                ;; never correct, so we need to replace the store reference.
-                (("tibanna_args.command = command")
-                 (string-append
-                  "tibanna_args.command = command.replace('"
-                  #$output "/bin/snakemake', 'python3 -m snakemake')")))))
-          ;; No longer needed with 7.15.2+
-          (add-after 'unpack 'tabulate-compatibility
-            (lambda _
-              (substitute* "snakemake/dag.py"
-                (("\"job\": rule,")
-                 "\"job\": rule.name,"))))
-          (add-after 'unpack 'patch-version
-            (lambda _
-              (substitute* "setup.py"
-                (("version=versioneer.get_version\\(\\)")
-                 (format #f "version=~s" #$version)))
-              (substitute* '("snakemake/_version.py"
-                             "versioneer.py")
-                (("0\\+unknown") #$version))))
-          (replace 'check
-            (lambda* (#:key tests? #:allow-other-keys)
-              (when tests?
-                (setenv "HOME" "/tmp")
-                ;; This test attempts to change S3 buckets on AWS and fails
-                ;; because there are no AWS credentials.
-                (delete-file "tests/test_tibanna.py")
-                ;; It's a similar story with this test, which requires access
-                ;; to the Google Storage service.
-                (delete-file "tests/test_google_lifesciences.py")
-                (invoke "pytest")))))))
-    (propagated-inputs
-     (list python-appdirs
-           python-configargparse
-           python-connection-pool
-           python-datrie
-           python-docutils
-           python-filelock
-           python-gitpython
-           python-jinja2
-           python-jsonschema
-           python-nbformat
-           python-networkx
-           python-psutil
-           python-pulp
-           python-pyyaml
-           python-py-tes
-           python-ratelimiter
-           python-requests
-           python-retry
-           python-smart-open
-           python-stopit
-           python-tabulate
-           python-toposort
-           python-wrapt
-           python-yte))
-    (native-inputs
-     (list git-minimal
-           python-wrapper
-           python-pytest
-           python-pandas
-           python-requests-mock
-           python-setuptools
-           python-wheel))))
-
 (define-public python-pyqrcode
   (package
     (name "python-pyqrcode")
-- 
2.48.1