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>
This commit is contained in:
Pierre Langlois 2020-06-18 00:58:41 +02:00 committed by Ludovic Courtès
parent 3a79adab41
commit 20b545f768
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 50 additions and 19 deletions

View file

@ -943,7 +943,9 @@ (define-public python-biom-format
("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)

View file

@ -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 @@ (define-module (gnu packages python-science)
#: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 @@ (define-public python-scikit-image
(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 @@ (define-public python-pandas
(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 @@ (define-public python-pandas
(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 @@ (define-public python-pandas
("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 @@ (define-public python-pandas
(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")