gnu: python-nbconvert: Update to 6.5.0.

* gnu/packages/python-xyz.scm (python-nbconvert): Update to 6.5.0.
[arguments]: Use gexps.
[phases]{fix-paths-and-tests}: Rename to...
{fix-paths}: ... this.  Find inputs via search-input-file.  Patch inskcape
file name.  Disable tests in...
{check}: ... this phase instead.  Do not set HOME.  Execute installed test
suite.  Run tests in parallel.  Disable and not
test_execute_widgets_from_nbconvert and test_execute_multiple_notebooks tests.
[inputs]: Add inkscape.
[native-inputs]: Delete python-pytest-cov and python-pytest-dependency.  Use
new style.
[propagated-inputs]: Add python-beautifulsoup4.  Reduce the texlive packages
part of the generated updmap.cfg input, moving them to regular propagated
inputs.  Add texlive-unicode-math and texlive-lm-math.
This commit is contained in:
Maxim Cournoyer 2022-04-13 15:50:36 -04:00
parent 15d4664f87
commit 724731de4c
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -174,6 +174,7 @@
#:use-module (gnu packages gtk) #:use-module (gnu packages gtk)
#:use-module (gnu packages haskell-xyz) #:use-module (gnu packages haskell-xyz)
#:use-module (gnu packages icu4c) #:use-module (gnu packages icu4c)
#:use-module (gnu packages inkscape)
#:use-module (gnu packages image) #:use-module (gnu packages image)
#:use-module (gnu packages imagemagick) #:use-module (gnu packages imagemagick)
#:use-module (gnu packages jupyter) #:use-module (gnu packages jupyter)
@ -13587,70 +13588,71 @@ time.")
(define-public python-nbconvert (define-public python-nbconvert
(package (package
(name "python-nbconvert") (name "python-nbconvert")
(version "6.0.7") (version "6.5.0")
(source (source
(origin (origin
(method url-fetch) (method url-fetch)
(uri (pypi-uri "nbconvert" version)) (uri (pypi-uri "nbconvert" version))
(sha256 (sha256
(base32 (base32
"00lhqaxn481qvk2w5568asqlsnvrw2fm61p1vssx3m7vdnl17g6b")))) "17g9xq4za7vvzml6l6d8zrzknhxsvgx02hymmsw9d1dygbi4cgi2"))))
(build-system python-build-system) (build-system python-build-system)
(arguments (arguments
`(#:phases (list
(modify-phases %standard-phases #:phases
(add-after 'unpack 'fix-paths-and-tests #~(modify-phases %standard-phases
(lambda _ (add-after 'unpack 'fix-paths
(lambda* (#:key inputs #:allow-other-keys)
;; Use pandoc binary from input. ;; Use pandoc binary from input.
(substitute* "nbconvert/utils/pandoc.py" (substitute* "nbconvert/utils/pandoc.py"
(("'pandoc'") (string-append "'" (which "pandoc") "'"))) (("'pandoc'")
(format #f "~s" (search-input-file inputs "bin/pandoc"))))
;; Same for LaTeX. ;; Same for LaTeX.
(substitute* "nbconvert/exporters/pdf.py" (substitute* "nbconvert/exporters/pdf.py"
(("\"xelatex\"") (string-append "\"" (which "xelatex") "\"")) (("\"xelatex\"")
(("\"bibtex\"") (string-append "\"" (which "bibtex") "\""))) (format #f "~s" (search-input-file inputs "bin/xelatex")))
;; Make sure tests are not skipped. (("\"bibtex\"")
(substitute* (find-files "." "test_.+\\.py$") (format #f "~s" (search-input-file inputs "bin/bibtex"))))
(("@onlyif_cmds_exist\\(('(pandoc|xelatex)'(, )?)+\\)") "")) ;; Likewise for Inkscape.
;; Pandoc is never missing, disable test. (substitute* "nbconvert/preprocessors/svg2pdf.py"
(substitute* "nbconvert/utils/tests/test_pandoc.py" (("inkscape_path = which\\(\"inkscape\")")
(("import os" all) (string-append all "\nimport pytest")) (format #f "inkscape_path = ~s"
(("(.+)(def test_pandoc_available)" all indent def) (search-input-file inputs "bin/inkscape"))))))
(string-append indent "@pytest.mark.skip('disabled by guix')\n"
indent def)))
;; Not installing pyppeteer, delete test.
(delete-file "nbconvert/exporters/tests/test_webpdf.py")
(substitute* "nbconvert/tests/test_nbconvertapp.py"
(("(.+)(def test_webpdf_with_chromium)" all indent def)
(string-append indent "@pytest.mark.skip('disabled by guix')\n"
indent def)))))
(replace 'check (replace 'check
(lambda* (#:key tests? inputs outputs #:allow-other-keys) (lambda* (#:key tests? #:allow-other-keys)
(when tests? (when tests?
;; Some tests invoke the installed nbconvert binary.
(add-installed-pythonpath inputs outputs)
;; Tests depend on templates installed to output. ;; Tests depend on templates installed to output.
(setenv "JUPYTER_PATH" (setenv "JUPYTER_PATH"
(string-append (string-append #$output "/share/jupyter:"
(assoc-ref outputs "out")
"/share/jupyter:"
(getenv "JUPYTER_PATH"))) (getenv "JUPYTER_PATH")))
;; Some tests need HOME ;; Step outside of the source directory to avoid having both
(setenv "HOME" "/tmp") ;; the installed package *and* the package from the source on
(invoke "pytest" "-vv"))))))) ;; Python's path.
(with-directory-excursion "/tmp"
(invoke "pytest" "--pyargs" "nbconvert"
"-vv" "-n" (number->string (parallel-job-count))
"-k"
(string-append
;; These tests require pyppeteer, not yet
;; available in Guix.
"not test_webpdf_with_chromium "
"and not test_webpdf.py "
;; These tests require ipywidgets, which would
;; introduce a dependency cycle.
"and not test_execute_widgets_from_nbconvert "
"and not test_execute_multiple_notebooks ")))))))))
(inputs (inputs
(list pandoc (list inkscape pandoc))
;; XXX: Disabled, needs substitute*.
;;("inkscape" ,inkscape)
))
(native-inputs (native-inputs
`(("python-ipykernel" ,python-ipykernel) (list python-ipykernel
;; XXX: Disabled, not in guix. ;; Adding ipywidgets would create a cycle.
;;("python-pyppeteer" ,python-pyppeteer) ;;python-ipywidgets
("python-pytest" ,python-pytest) ;;python-pyppeteer ;TODO: package me
("python-pytest-cov" ,python-pytest-cov) python-pytest
("python-pytest-dependency" ,python-pytest-dependency))) python-pytest-xdist))
(propagated-inputs (propagated-inputs
(list python-bleach (list python-beautifulsoup4
python-bleach
python-defusedxml python-defusedxml
python-entrypoints python-entrypoints
python-jinja2 python-jinja2
@ -13666,37 +13668,39 @@ time.")
;; Required, even if [serve] is not used. ;; Required, even if [serve] is not used.
python-tornado-6 python-tornado-6
;; Required at runtime for `jupyter nbconvert --to=pdf`. ;; Required at runtime for `jupyter nbconvert --to=pdf`.
(texlive-updmap.cfg (list texlive-adjustbox texlive-adjustbox
texlive-amsfonts
texlive-booktabs texlive-booktabs
texlive-caption texlive-caption
texlive-enumitem texlive-enumitem
texlive-eurosym
texlive-fonts-rsfs
texlive-generic-iftex
texlive-jknappen
texlive-latex-amsmath
texlive-latex-fancyvrb
texlive-latex-float
texlive-fontspec texlive-fontspec
texlive-latex-geometry texlive-generic-iftex
texlive-grffile texlive-grffile
texlive-hyperref texlive-hyperref
texlive-latex-fancyvrb
texlive-latex-float
texlive-latex-geometry
texlive-latex-jknapltx texlive-latex-jknapltx
texlive-latex-ms texlive-latex-ms
texlive-oberdiek
texlive-latex-parskip texlive-latex-parskip
texlive-latex-trimspaces texlive-latex-trimspaces
texlive-latex-upquote texlive-latex-upquote
texlive-latex-ucs
texlive-lm
texlive-mathpazo
texlive-stringenc texlive-stringenc
texlive-tcolorbox texlive-tcolorbox
texlive-titling texlive-titling
texlive-tools texlive-tools
texlive-ulem texlive-ulem
texlive-unicode-math
texlive-xcolor texlive-xcolor
(texlive-updmap.cfg (list texlive-amsfonts
texlive-eurosym
texlive-fonts-rsfs
texlive-jknappen
texlive-latex-amsmath
texlive-latex-ucs
texlive-lm
texlive-lm-math
texlive-mathpazo
texlive-oberdiek
texlive-zapfding)))) texlive-zapfding))))
(home-page "https://jupyter.org") (home-page "https://jupyter.org")
(synopsis "Converting Jupyter Notebooks") (synopsis "Converting Jupyter Notebooks")