summaryrefslogtreecommitdiff
path: root/gnu/packages/python-science.scm
diff options
context:
space:
mode:
authorSharlatan Hellseher <sharlatanus@gmail.com>2025-05-26 17:36:37 +0100
committerSharlatan Hellseher <sharlatanus@gmail.com>2025-05-26 17:36:37 +0100
commit74d1cf2583acab63e55f018af2c4d5d7136dc81d (patch)
treeb7fa2578e15e2b51cba56fe9bc9e535c23200751 /gnu/packages/python-science.scm
parent127f232d1dce05bb843d28bf9501fd2b7c2e64de (diff)
gnu: Move all snakemake variants to python-science.
* gnu/packages/python-xyz.scm (snakemake-5, snakemake-6, snakemake-7): Move from here ... * gnu/packages/python-science.scm: ... to here. Change-Id: Ia771b316049f375183025e7617e6d0ddf06f99ff
Diffstat (limited to 'gnu/packages/python-science.scm')
-rw-r--r--gnu/packages/python-science.scm271
1 files changed, 271 insertions, 0 deletions
diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm
index 7792e51e30..376ae67570 100644
--- a/gnu/packages/python-science.scm
+++ b/gnu/packages/python-science.scm
@@ -5004,6 +5004,277 @@ providing a clean and modern domain specific specification language (DSL) in
Python style, together with a fast and comfortable execution environment.")
(license license:expat)))
+(define-public snakemake-5
+ (package
+ (name "snakemake")
+ (version "5.32.2")
+ (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 "0nxp4z81vykv07kv2b6zrwk7ns8s10zqsb7vcignp8695yq3nlcm"))))
+ (build-system pyproject-build-system)
+ (arguments
+ (list
+ #:test-flags
+ '(list
+ ;; We have no TES support.
+ "--ignore=tests/test_tes.py"
+ ;; This test attempts to change S3 buckets on AWS and fails
+ ;; 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"
+ ;; Unclear failure.
+ "-k" "not test_lint[long_run-positive]")
+ #:phases
+ #~(modify-phases %standard-phases
+ (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))))
+ ;; For cluster execution Snakemake will call Python. Since there is
+ ;; no suitable PYTHONPATH set, cluster execution will fail. We fix
+ ;; this by calling the snakemake wrapper instead.
+ (add-after 'unpack 'call-wrapper-not-wrapped-snakemake
+ (lambda _
+ (substitute* "snakemake/executors/__init__.py"
+ (("\\{sys.executable\\} -m snakemake")
+ (string-append #$output "/bin/snakemake")))))
+ (add-before 'check 'pre-check
+ (lambda _ (setenv "HOME" "/tmp"))))))
+ (propagated-inputs
+ (list python-appdirs
+ python-configargparse
+ python-datrie
+ python-docutils
+ python-gitpython
+ python-jinja2
+ python-jsonschema
+ python-nbformat
+ python-networkx
+ python-psutil
+ python-pulp
+ python-pyyaml
+ python-ratelimiter
+ python-requests
+ python-toposort
+ python-wrapt))
+ (native-inputs
+ (list git-minimal
+ python-wrapper
+ python-pytest
+ python-pandas
+ python-requests-mock
+ python-setuptools
+ python-wheel))
+ (home-page "https://snakemake.readthedocs.io")
+ (synopsis "Python-based execution environment for make-like workflows")
+ (description
+ "Snakemake aims to reduce the complexity of creating workflows by
+providing a clean and modern domain specific specification language (DSL) in
+Python style, together with a fast and comfortable execution environment.")
+ (license license:expat)))
+
+(define-public snakemake-6
+ (package
+ (inherit snakemake-5)
+ (name "snakemake")
+ (version "6.15.5")
+ (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 "09yrpi9f86r9yvcm2dfjs5zy87c4j31bxama77kfd6y8yfrrjlai"))))
+ (build-system pyproject-build-system)
+ (arguments
+ (list
+ #:test-flags
+ '(list
+ ;; This test attempts to change S3 buckets on AWS and fails
+ ;; because there are no AWS credentials.
+ "--ignore=tests/test_tibanna.py"
+ ;; Unclear failure.
+ "-k" "not test_lint[long_run-positive]")
+ #: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.
+
+ ;; XXX: There is another instance of sys.executable on line 692, but
+ ;; it is not clear how to patch it.
+ (add-after 'unpack 'call-wrapper-not-wrapped-snakemake
+ (lambda* (#:key outputs #:allow-other-keys)
+ (substitute* "snakemake/executors/__init__.py"
+ (("\\{sys.executable\\} -m snakemake")
+ (string-append #$output "/bin/snakemake")))))
+ (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))))
+ (add-before 'check 'pre-check
+ (lambda _ (setenv "HOME" "/tmp"))))))
+ (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-smart-open
+ python-stopit
+ python-tabulate
+ python-toposort
+ python-wrapt))
+ (native-inputs
+ (list git-minimal
+ python-wrapper
+ python-pytest
+ python-pandas
+ python-requests-mock
+ python-setuptools
+ python-wheel))))
+
+(define-public snakemake-7
+ (package
+ (inherit snakemake-6)
+ (name "snakemake")
+ (version "7.32.4")
+ (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 "1d5hizai89k1glfqfkvf1ghj0l7wm8il6gl5pfwk2gkza87yka6d"))))
+ (build-system pyproject-build-system)
+ (arguments
+ (list
+ #:test-flags
+ ;; This test attempts to change S3 buckets on AWS and fails
+ ;; because there are no AWS credentials.
+ '(list "--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"
+ "--ignore-glob=tests/test_conda_python_3_7_script/*"
+ ;; We don't have a slurm installation in the build environment
+ "--ignore=tests/test_slurm.py")
+ #: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')")))))
+ (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))))
+ (add-before 'check 'pre-check
+ (lambda _ (setenv "HOME" "/tmp"))))))
+ (propagated-inputs
+ (list python-appdirs
+ python-configargparse
+ python-connection-pool
+ python-datrie
+ python-docutils
+ python-filelock
+ python-gitpython
+ python-humanfriendly
+ python-jinja2
+ python-jsonschema
+ python-nbformat
+ python-networkx
+ python-psutil
+ python-pulp
+ python-pyyaml
+ python-py-tes
+ python-requests
+ python-retry
+ python-reretry
+ python-smart-open
+ python-stopit
+ python-tabulate
+ python-throttler
+ 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