summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorPierre Langlois <pierre.langlois@gmx.com>2020-06-18 00:58:41 +0200
committerLudovic Courtès <ludo@gnu.org>2020-06-22 15:44:08 +0200
commit20b545f76835605143c7b9c337dfe0539c102695 (patch)
treed1a32207f74acb0e20aed95f97e23eac81d0f825 /gnu
parent3a79adab417f4fab6d9ac2b0f839b8d03ed6bb42 (diff)
downloadguix-20b545f76835605143c7b9c337dfe0539c102695.tar.gz
gnu: python-pandas: Update to 1.0.5.
But also keep version 0.25.3 around for packages requiring an earlier
versions, as well as version 0.24.2 for a version with python2.

* gnu/packages/python-science.scm (python-pandas): Update to 1.0.5.
[arguments]: Adapt 'patch-which phase.  Add new 'prepare-x phase.  Do not
delete tests that depend on "moto", they are skipped automatically.
[propagated-inputs]: Add python-jinja2.
[inputs]: Add xsel and xclip.
[native-inputs]: Add xorg-server-for-tests so we can test clipboard support.
(python-pandas-0.24): New variable.
(python2-pandas): Inherit from python-pandas-0.25.
* gnu/packages/bioinformatics.scm (python-biom-format)[propagated-inputs]:
Switch to python-pandas-0.25.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/bioinformatics.scm4
-rw-r--r--gnu/packages/python-science.scm65
2 files changed, 50 insertions, 19 deletions
diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 784fff7c09..b24266159b 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -943,7 +943,9 @@ Python.")
        ("python-future" ,python-future)
        ("python-click" ,python-click)
        ("python-h5py" ,python-h5py)
-       ("python-pandas" ,python-pandas)))
+       ;; FIXME: Upgrade to pandas 1.0 when
+       ;; https://github.com/biocore/biom-format/issues/837 is resolved.
+       ("python-pandas" ,python-pandas-0.25)))
     (native-inputs
      `(("python-cython" ,python-cython)
        ("python-pytest" ,python-pytest)
diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm
index 2f7516b9f6..55fc1be4f9 100644
--- a/gnu/packages/python-science.scm
+++ b/gnu/packages/python-science.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2019 Giacomo Leidi <goodoldpaul@autistici.org>
+;;; Copyright © 2020 Pierre Langlois <pierre.langlois@gmx.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -37,7 +38,9 @@
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages sphinx)
   #:use-module (gnu packages time)
+  #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xml)
+  #:use-module (gnu packages xorg)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix utils)
@@ -231,13 +234,13 @@ Cython.")
 (define-public python-pandas
   (package
     (name "python-pandas")
-    (version "0.25.2")
+    (version "1.0.5")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "pandas" version))
        (sha256
-        (base32 "1gp2pvzdiakvgjmykdzdlzrsfbg4vjm49jjdl9s0ha0a3yfs34fa"))))
+        (base32 "1a2gv3g6jr6vb5ca43fkwjl5xf86wpfz8y3zcy787adjl0hdkib9"))))
     (build-system python-build-system)
     (arguments
      `(#:modules ((guix build utils)
@@ -249,8 +252,15 @@ Cython.")
                     (lambda* (#:key inputs #:allow-other-keys)
                       (let ((which (assoc-ref inputs "which")))
                         (substitute* "pandas/io/clipboard/__init__.py"
-                          (("^CHECK_CMD = .*")
-                           (string-append "CHECK_CMD = \"" which "\"\n"))))
+                          (("^WHICH_CMD = .*")
+                           (string-append "WHICH_CMD = \"" which "\"\n"))))
+                      #t))
+                  (add-before 'check 'prepare-x
+                    (lambda _
+                      (system "Xvfb &")
+                      (setenv "DISPLAY" ":0")
+                      ;; xsel needs to write a log file.
+                      (setenv "HOME" "/tmp")
                       #t))
                   (replace 'check
                     (lambda _
@@ -265,25 +275,19 @@ Cython.")
                         (substitute* "setup.cfg"
                           (("addopts = --strict-data-files") "addopts = "))
                         (with-directory-excursion build-directory
-                          ;; Delete tests that require "moto" which is not yet
-                          ;; in Guix.
-                          (for-each delete-file
-                                    '("pandas/tests/io/conftest.py"
-                                      "pandas/tests/io/json/test_compression.py"
-                                      "pandas/tests/io/parser/test_network.py"
-                                      "pandas/tests/io/test_parquet.py"))
                           (invoke "pytest" "-vv" "pandas" "--skip-slow"
-                                  "--skip-network" "-k"
-                                  ;; XXX: Due to the deleted tests above.
-                                  "not test_read_s3_jsonl"))))))))
+                                  "--skip-network"))))))))
     (propagated-inputs
-     `(("python-numpy" ,python-numpy)
+     `(("python-jinja2" ,python-jinja2)
+       ("python-numpy" ,python-numpy)
        ("python-openpyxl" ,python-openpyxl)
        ("python-pytz" ,python-pytz)
        ("python-dateutil" ,python-dateutil)
        ("python-xlrd" ,python-xlrd)))
     (inputs
-     `(("which" ,which)))
+     `(("which" ,which)
+       ("xclip" ,xclip)
+       ("xsel" ,xsel)))
     (native-inputs
      `(("python-cython" ,python-cython)
        ("python-beautifulsoup4" ,python-beautifulsoup4)
@@ -291,7 +295,9 @@ Cython.")
        ("python-html5lib" ,python-html5lib)
        ("python-nose" ,python-nose)
        ("python-pytest" ,python-pytest)
-       ("python-pytest-mock" ,python-pytest-mock)))
+       ("python-pytest-mock" ,python-pytest-mock)
+       ;; Needed to test clipboard support.
+       ("xorg-server" ,xorg-server-for-tests)))
     (home-page "https://pandas.pydata.org")
     (synopsis "Data structures for data analysis, time series, and statistics")
     (description
@@ -303,10 +309,33 @@ doing practical, real world data analysis in Python.")
     (properties `((python2-variant . ,(delay python2-pandas))))
     (license license:bsd-3)))
 
+(define-public python-pandas-0.25
+  (package
+    (inherit python-pandas)
+    (version "0.25.3")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "pandas" version))
+              (sha256
+               (base32
+                "191048m6kdc6yfvqs9w412lq60cfvigrsb57y0x116lwibgp9njj"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments python-pandas)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (replace 'patch-which
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let ((which (assoc-ref inputs "which")))
+                 (substitute* "pandas/io/clipboard/__init__.py"
+                   (("^CHECK_CMD = .*")
+                     (string-append "CHECK_CMD = \"" which "\"\n"))))
+               #t))
+           (delete 'prepare-x)))))))
+
 ;; Pandas 0.24.x are the last versions that support Python 2.
 (define-public python2-pandas
   (let ((pandas (package-with-python2
-                 (strip-python2-variant python-pandas))))
+                 (strip-python2-variant python-pandas-0.25))))
     (package
       (inherit pandas)
       (version "0.24.2")