From ec1224a73b2c0c0c15a3293261334f3927f6579d Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Mon, 2 Dec 2019 14:04:39 +0100 Subject: [PATCH] gnu: python-scipy: Move to (gnu packages python-science). * gnu/packages/python-xyz.scm (python-scipy, python2-scipy): Move these from here... * gnu/packages/python-science.scm (python-scipy, python2-scipy): ...to here. * gnu/packages/bioinformatics.scm, gnu/packages/machine-learning.scm, gnu/packages/statistics.scm: Adjust module imports. --- gnu/packages/bioinformatics.scm | 1 + gnu/packages/machine-learning.scm | 1 + gnu/packages/python-science.scm | 126 ++++++++++++++++++++++++++++++ gnu/packages/python-xyz.scm | 119 ---------------------------- gnu/packages/statistics.scm | 1 + 5 files changed, 129 insertions(+), 119 deletions(-) diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm index 616fcedc35..b0d070b4e7 100644 --- a/gnu/packages/bioinformatics.scm +++ b/gnu/packages/bioinformatics.scm @@ -105,6 +105,7 @@ #:use-module (gnu packages protobuf) #:use-module (gnu packages python) #:use-module (gnu packages python-compression) + #:use-module (gnu packages python-science) #:use-module (gnu packages python-web) #:use-module (gnu packages python-xyz) #:use-module (gnu packages readline) diff --git a/gnu/packages/machine-learning.scm b/gnu/packages/machine-learning.scm index b83b336d84..ab4150cbb1 100644 --- a/gnu/packages/machine-learning.scm +++ b/gnu/packages/machine-learning.scm @@ -69,6 +69,7 @@ #:use-module (gnu packages pkg-config) #:use-module (gnu packages protobuf) #:use-module (gnu packages python) + #:use-module (gnu packages python-science) #:use-module (gnu packages python-web) #:use-module (gnu packages python-xyz) #:use-module (gnu packages serialization) diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm index 4636180dfa..93fc63c2e7 100644 --- a/gnu/packages/python-science.scm +++ b/gnu/packages/python-science.scm @@ -24,12 +24,138 @@ (define-module (gnu packages python-science) #:use-module ((guix licenses) #:prefix license:) #:use-module (gnu packages) + #:use-module (gnu packages base) + #:use-module (gnu packages check) + #:use-module (gnu packages gcc) + #:use-module (gnu packages maths) + #:use-module (gnu packages perl) + #:use-module (gnu packages python) #:use-module (gnu packages python-xyz) + #:use-module (gnu packages sphinx) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix utils) #:use-module (guix build-system python)) +(define-public python-scipy + (package + (name "python-scipy") + (version "1.3.2") + (source + (origin + (method url-fetch) + (uri (pypi-uri "scipy" version)) + (sha256 + (base32 "192d8dsybvhv19igkrsafbdafx198nz7pibkjgrqjhlr66s3jfd0")))) + (build-system python-build-system) + (propagated-inputs + `(("python-numpy" ,python-numpy) + ("python-matplotlib" ,python-matplotlib) + ("python-pyparsing" ,python-pyparsing))) + (inputs + `(("lapack" ,lapack) + ("openblas" ,openblas))) + (native-inputs + `(("python-cython" ,python-cython) + ("python-pytest" ,python-pytest) + ("python-sphinx" ,python-sphinx) + ("python-numpydoc" ,python-numpydoc) + ("gfortran" ,gfortran) + ("perl" ,perl) + ("which" ,which))) + (outputs '("out" "doc")) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'disable-broken-tests + (lambda _ + (substitute* "scipy/sparse/linalg/dsolve/tests/test_linsolve.py" + (("^( +)def test_threads_parallel\\(self\\):" m indent) + (string-append indent + "@pytest.mark.skip(reason=\"Disabled by Guix\")\n" + m))) + (substitute* "scipy/sparse/linalg/eigen/arpack/tests/test_arpack.py" + (("^def test_parallel_threads\\(\\):" m) + (string-append "@pytest.mark.skip(reason=\"Disabled by Guix\")\n" + m))) + #t)) + (add-before 'build 'configure-openblas + (lambda* (#:key inputs #:allow-other-keys) + (call-with-output-file "site.cfg" + (lambda (port) + (format port + "[blas] +libraries = openblas +library_dirs = ~a/lib +include_dirs = ~a/include + +# backslash-n to make emacs happy +\n[atlas] +library_dirs = ~a/lib +atlas_libs = openblas +" + (assoc-ref inputs "openblas") + (assoc-ref inputs "openblas") + (assoc-ref inputs "openblas")))) + #t)) + (add-after 'install 'install-doc + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((data (string-append (assoc-ref outputs "doc") "/share")) + (doc (string-append data "/doc/" ,name "-" ,version)) + (html (string-append doc "/html")) + (pyver ,(string-append "PYVER=" (version-major+minor + (package-version python)))) + ;; By default it tries to run sphinx-build through the Python + ;; interpreter which won't work with our shell wrapper. + (sphinxbuild "SPHINXBUILD=LANG=C sphinx-build")) + ;; Make installed package available for building the + ;; documentation + (add-installed-pythonpath inputs outputs) + (with-directory-excursion "doc" + ;; Fix generation of images for mathematical expressions. + (substitute* (find-files "source" "conf\\.py") + (("pngmath_use_preview = True") + "pngmath_use_preview = False")) + (mkdir-p html) + (invoke "make" "html" pyver sphinxbuild) + (with-directory-excursion "build/html" + (for-each (lambda (file) + (let* ((dir (dirname file)) + (tgt-dir (string-append html "/" dir))) + (install-file file html))) + (find-files "." ".*"))))) + #t)) + ;; Tests can only be run after the library has been installed and not + ;; within the source directory. + (delete 'check) + (add-after 'install 'check + (lambda* (#:key inputs outputs #:allow-other-keys) + (add-installed-pythonpath inputs outputs) + (with-directory-excursion "/tmp" + (invoke "python" "-c" + "import scipy; scipy.test(verbose=2)"))))))) + (home-page "https://www.scipy.org/") + (synopsis "The Scipy library provides efficient numerical routines") + (description "The SciPy library is one of the core packages that make up +the SciPy stack. It provides many user-friendly and efficient numerical +routines such as routines for numerical integration and optimization.") + (properties `((python2-variant . ,(delay python2-scipy)))) + (license license:bsd-3))) + +;; Version 1.2.2 is the last version to support Python 2 +(define-public python2-scipy + (package + (inherit (package-with-python2 + (strip-python2-variant python-scipy))) + (version "1.2.2") + (source + (origin + (method url-fetch) + (uri (pypi-uri "scipy" version)) + (sha256 + (base32 + "1cgvgin8fvckv96hjh3ikmwkra5rif51bdb75ifzf7xbil5iwcx4")))))) + (define-public python-scikit-image (package (name "python-scikit-image") diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 1d6f0a8367..f52d9a410f 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -4277,125 +4277,6 @@ those files. It can also efficiently manipulate ranges of integers using set operators such as union, intersection, and difference.") (license license:asl2.0))) -(define-public python-scipy - (package - (name "python-scipy") - (version "1.3.2") - (source - (origin - (method url-fetch) - (uri (pypi-uri "scipy" version)) - (sha256 - (base32 "192d8dsybvhv19igkrsafbdafx198nz7pibkjgrqjhlr66s3jfd0")))) - (build-system python-build-system) - (propagated-inputs - `(("python-numpy" ,python-numpy) - ("python-matplotlib" ,python-matplotlib) - ("python-pyparsing" ,python-pyparsing))) - (inputs - `(("lapack" ,lapack) - ("openblas" ,openblas))) - (native-inputs - `(("python-cython" ,python-cython) - ("python-pytest" ,python-pytest) - ("python-sphinx" ,python-sphinx) - ("python-numpydoc" ,python-numpydoc) - ("gfortran" ,gfortran) - ("perl" ,perl) - ("which" ,which))) - (outputs '("out" "doc")) - (arguments - `(#:phases - (modify-phases %standard-phases - (add-after 'unpack 'disable-broken-tests - (lambda _ - (substitute* "scipy/sparse/linalg/dsolve/tests/test_linsolve.py" - (("^( +)def test_threads_parallel\\(self\\):" m indent) - (string-append indent - "@pytest.mark.skip(reason=\"Disabled by Guix\")\n" - m))) - (substitute* "scipy/sparse/linalg/eigen/arpack/tests/test_arpack.py" - (("^def test_parallel_threads\\(\\):" m) - (string-append "@pytest.mark.skip(reason=\"Disabled by Guix\")\n" - m))) - #t)) - (add-before 'build 'configure-openblas - (lambda* (#:key inputs #:allow-other-keys) - (call-with-output-file "site.cfg" - (lambda (port) - (format port - "[blas] -libraries = openblas -library_dirs = ~a/lib -include_dirs = ~a/include - -# backslash-n to make emacs happy -\n[atlas] -library_dirs = ~a/lib -atlas_libs = openblas -" - (assoc-ref inputs "openblas") - (assoc-ref inputs "openblas") - (assoc-ref inputs "openblas")))) - #t)) - (add-after 'install 'install-doc - (lambda* (#:key inputs outputs #:allow-other-keys) - (let* ((data (string-append (assoc-ref outputs "doc") "/share")) - (doc (string-append data "/doc/" ,name "-" ,version)) - (html (string-append doc "/html")) - (pyver ,(string-append "PYVER=" (version-major+minor - (package-version python)))) - ;; By default it tries to run sphinx-build through the Python - ;; interpreter which won't work with our shell wrapper. - (sphinxbuild "SPHINXBUILD=LANG=C sphinx-build")) - ;; Make installed package available for building the - ;; documentation - (add-installed-pythonpath inputs outputs) - (with-directory-excursion "doc" - ;; Fix generation of images for mathematical expressions. - (substitute* (find-files "source" "conf\\.py") - (("pngmath_use_preview = True") - "pngmath_use_preview = False")) - (mkdir-p html) - (invoke "make" "html" pyver sphinxbuild) - (with-directory-excursion "build/html" - (for-each (lambda (file) - (let* ((dir (dirname file)) - (tgt-dir (string-append html "/" dir))) - (install-file file html))) - (find-files "." ".*"))))) - #t)) - ;; Tests can only be run after the library has been installed and not - ;; within the source directory. - (delete 'check) - (add-after 'install 'check - (lambda* (#:key inputs outputs #:allow-other-keys) - (add-installed-pythonpath inputs outputs) - (with-directory-excursion "/tmp" - (invoke "python" "-c" - "import scipy; scipy.test(verbose=2)"))))))) - (home-page "https://www.scipy.org/") - (synopsis "The Scipy library provides efficient numerical routines") - (description "The SciPy library is one of the core packages that make up -the SciPy stack. It provides many user-friendly and efficient numerical -routines such as routines for numerical integration and optimization.") - (properties `((python2-variant . ,(delay python2-scipy)))) - (license license:bsd-3))) - -;; Version 1.2.2 is the last version to support Python 2 -(define-public python2-scipy - (package - (inherit (package-with-python2 - (strip-python2-variant python-scipy))) - (version "1.2.2") - (source - (origin - (method url-fetch) - (uri (pypi-uri "scipy" version)) - (sha256 - (base32 - "1cgvgin8fvckv96hjh3ikmwkra5rif51bdb75ifzf7xbil5iwcx4")))))) - (define-public python-socksipy-branch (package (name "python-socksipy-branch") diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm index b84b3803ea..1d6e6aaff5 100644 --- a/gnu/packages/statistics.scm +++ b/gnu/packages/statistics.scm @@ -66,6 +66,7 @@ #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) + #:use-module (gnu packages python-science) #:use-module (gnu packages python-xyz) #:use-module (gnu packages readline) #:use-module (gnu packages sphinx)