gnu: python-pandas: Update to 1.5.3.

* gnu/packages/python-science.scm (python-pandas): Update to 1.5.3.
[build-system]: Use pyproject-build-system.
[arguments]: Use G-expression; move test flags to #:test-flags; add phase
'patch-build-system; fix substitution of "which" executable; remove
'enable-parallel-build; remove custom 'check phase; add 'pre-check phase.
[propagated-inputs]: Add python-matplotlib.
[native-inputs]: Replace python-cython with python-cython-0.29.35.

Change-Id: I9d09971f707b925f469e29be67fe040c181314ff
This commit is contained in:
Ricardo Wurmus 2024-01-11 10:13:17 +01:00
parent fbe0233575
commit a8c1d812a0
No known key found for this signature in database
GPG key ID: 197A5888235FACAC

View file

@ -480,71 +480,73 @@ (define-public python-tspex
(define-public python-pandas (define-public python-pandas
(package (package
(name "python-pandas") (name "python-pandas")
(version "1.4.4") (version "1.5.3")
(source (source
(origin (origin
(method url-fetch) (method url-fetch)
(uri (pypi-uri "pandas" version)) (uri (pypi-uri "pandas" version))
(sha256 (sha256
(base32 "0ryv66s9cvd27q6a985vv556k2qlnlrdna2z7qc7bdhphrrhsv5b")))) (base32 "1cdhngylzh352wx5s3sjyznn7a6kmjqcfg97hgqm5h3yb9zgv8vl"))))
(build-system python-build-system) (build-system pyproject-build-system)
(arguments (arguments
`(#:modules ((guix build utils) (list
(guix build python-build-system) #:test-flags
(ice-9 ftw) '(list "--pyargs" "pandas"
(srfi srfi-1) "-n" (number->string (parallel-job-count))
(srfi srfi-26)) "-m" "not slow and not network and not db"
"-k"
(string-append
;; TODO: Missing input
"not TestS3"
" and not s3"
;; No module named 'pandas.io.sas._sas'
" and not test_read_expands_user_home_dir"
" and not test_read_non_existent"
;; Unknown failures
" and not test_switch_options"
;; Crashes
" and not test_bytes_exceed_2gb"
;; get_subplotspec() returns None; possibly related to
;; https://github.com/pandas-dev/pandas/issues/54577
" and not test_plain_axes"
;; This test fails when run with pytest-xdist
;; (see https://github.com/pandas-dev/pandas/issues/39096).
" and not test_memory_usage"))
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'unpack 'enable-parallel-build (add-after 'unpack 'patch-build-system
(lambda _ (lambda _
(substitute* "setup.py" (substitute* "pyproject.toml"
(("\"-j\", type=int, default=1") ;; Not all data files are distributed with the tarball.
(format #f "\"-j\", type=int, default=~a" (("--strict-data-files ") "")
(parallel-job-count)))))) ;; Unknown property "asyncio_mode"
(("asyncio_mode = \"strict\"") ""))))
(add-after 'unpack 'patch-which (add-after 'unpack 'patch-which
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(let ((which (assoc-ref inputs "which")))
(substitute* "pandas/io/clipboard/__init__.py" (substitute* "pandas/io/clipboard/__init__.py"
(("^WHICH_CMD = .*") (("^WHICH_CMD = .*")
(string-append "WHICH_CMD = \"" which "\"\n")))))) (string-append "WHICH_CMD = \""
(search-input-file inputs "/bin/which")
"\"\n")))))
(add-before 'check 'prepare-x (add-before 'check 'prepare-x
(lambda _ (lambda _
(system "Xvfb &") (system "Xvfb &")
(setenv "DISPLAY" ":0") (setenv "DISPLAY" ":0")
;; xsel needs to write a log file. ;; xsel needs to write a log file.
(setenv "HOME" "/tmp"))) (setenv "HOME" "/tmp")))
(replace 'check ;; The compiled libraries are only in the output at this point,
(lambda* (#:key tests? #:allow-other-keys) ;; but they are needed to run tests.
(let ((build-directory ;; FIXME: This should be handled by the pyargs pytest argument,
(string-append ;; but is not for some reason.
(getcwd) "/build/" (add-before 'check 'pre-check
(first (scandir "build" (lambda* (#:key inputs outputs #:allow-other-keys)
(cut string-prefix? "lib." <>)))))) (copy-recursively
(substitute* "pyproject.toml" (string-append (site-packages inputs outputs)
;; Not all data files are distributed with the tarball. "/pandas/_libs")
(("--strict-data-files ") "")) "pandas/_libs"))))))
(with-directory-excursion build-directory
(when tests?
(invoke "pytest" "-vv" "pandas" "--skip-slow"
"--skip-network"
"-n" (number->string (parallel-job-count))
"-k"
(string-append
;; These test access the internet (see:
;; https://github.com/pandas-dev/pandas/issues/45085).:
;; pandas/tests/io/xml/test_xml.py::test_wrong_url[lxml]
;; pandas/tests/io/xml/test_xml.py::test_wrong_url[etree]
"not test_wrong_url"
;; TODO: Missing input
" and not TestS3"
" and not s3"
;; This test fails when run with pytest-xdist
;; (see:
;; https://github.com/pandas-dev/pandas/issues/39096).
" and not test_memory_usage"))))))))))
(propagated-inputs (propagated-inputs
(list python-jinja2 (list python-jinja2
python-matplotlib
python-numpy python-numpy
python-openpyxl python-openpyxl
python-pytz python-pytz
@ -554,7 +556,7 @@ (define-public python-pandas
(inputs (inputs
(list which xclip xsel)) (list which xclip xsel))
(native-inputs (native-inputs
(list python-cython (list python-cython-0.29.35
python-beautifulsoup4 python-beautifulsoup4
python-lxml python-lxml
python-html5lib python-html5lib