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
;; Use pandoc binary from input. (lambda* (#:key inputs #:allow-other-keys)
(substitute* "nbconvert/utils/pandoc.py" ;; Use pandoc binary from input.
(("'pandoc'") (string-append "'" (which "pandoc") "'"))) (substitute* "nbconvert/utils/pandoc.py"
;; Same for LaTeX. (("'pandoc'")
(substitute* "nbconvert/exporters/pdf.py" (format #f "~s" (search-input-file inputs "bin/pandoc"))))
(("\"xelatex\"") (string-append "\"" (which "xelatex") "\"")) ;; Same for LaTeX.
(("\"bibtex\"") (string-append "\"" (which "bibtex") "\""))) (substitute* "nbconvert/exporters/pdf.py"
;; Make sure tests are not skipped. (("\"xelatex\"")
(substitute* (find-files "." "test_.+\\.py$") (format #f "~s" (search-input-file inputs "bin/xelatex")))
(("@onlyif_cmds_exist\\(('(pandoc|xelatex)'(, )?)+\\)") "")) (("\"bibtex\"")
;; Pandoc is never missing, disable test. (format #f "~s" (search-input-file inputs "bin/bibtex"))))
(substitute* "nbconvert/utils/tests/test_pandoc.py" ;; Likewise for Inkscape.
(("import os" all) (string-append all "\nimport pytest")) (substitute* "nbconvert/preprocessors/svg2pdf.py"
(("(.+)(def test_pandoc_available)" all indent def) (("inkscape_path = which\\(\"inkscape\")")
(string-append indent "@pytest.mark.skip('disabled by guix')\n" (format #f "inkscape_path = ~s"
indent def))) (search-input-file inputs "bin/inkscape"))))))
;; Not installing pyppeteer, delete test. (replace 'check
(delete-file "nbconvert/exporters/tests/test_webpdf.py") (lambda* (#:key tests? #:allow-other-keys)
(substitute* "nbconvert/tests/test_nbconvertapp.py" (when tests?
(("(.+)(def test_webpdf_with_chromium)" all indent def) ;; Tests depend on templates installed to output.
(string-append indent "@pytest.mark.skip('disabled by guix')\n" (setenv "JUPYTER_PATH"
indent def))))) (string-append #$output "/share/jupyter:"
(replace 'check (getenv "JUPYTER_PATH")))
(lambda* (#:key tests? inputs outputs #:allow-other-keys) ;; Step outside of the source directory to avoid having both
(when tests? ;; the installed package *and* the package from the source on
;; Some tests invoke the installed nbconvert binary. ;; Python's path.
(add-installed-pythonpath inputs outputs) (with-directory-excursion "/tmp"
;; Tests depend on templates installed to output. (invoke "pytest" "--pyargs" "nbconvert"
(setenv "JUPYTER_PATH" "-vv" "-n" (number->string (parallel-job-count))
(string-append "-k"
(assoc-ref outputs "out") (string-append
"/share/jupyter:" ;; These tests require pyppeteer, not yet
(getenv "JUPYTER_PATH"))) ;; available in Guix.
;; Some tests need HOME "not test_webpdf_with_chromium "
(setenv "HOME" "/tmp") "and not test_webpdf.py "
(invoke "pytest" "-vv"))))))) ;; 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-fontspec
texlive-generic-iftex
texlive-grffile
texlive-hyperref
texlive-latex-fancyvrb
texlive-latex-float
texlive-latex-geometry
texlive-latex-jknapltx
texlive-latex-ms
texlive-latex-parskip
texlive-latex-trimspaces
texlive-latex-upquote
texlive-stringenc
texlive-tcolorbox
texlive-titling
texlive-tools
texlive-ulem
texlive-unicode-math
texlive-xcolor
(texlive-updmap.cfg (list texlive-amsfonts
texlive-eurosym texlive-eurosym
texlive-fonts-rsfs texlive-fonts-rsfs
texlive-generic-iftex
texlive-jknappen texlive-jknappen
texlive-latex-amsmath texlive-latex-amsmath
texlive-latex-fancyvrb
texlive-latex-float
texlive-fontspec
texlive-latex-geometry
texlive-grffile
texlive-hyperref
texlive-latex-jknapltx
texlive-latex-ms
texlive-oberdiek
texlive-latex-parskip
texlive-latex-trimspaces
texlive-latex-upquote
texlive-latex-ucs texlive-latex-ucs
texlive-lm texlive-lm
texlive-lm-math
texlive-mathpazo texlive-mathpazo
texlive-stringenc texlive-oberdiek
texlive-tcolorbox
texlive-titling
texlive-tools
texlive-ulem
texlive-xcolor
texlive-zapfding)))) texlive-zapfding))))
(home-page "https://jupyter.org") (home-page "https://jupyter.org")
(synopsis "Converting Jupyter Notebooks") (synopsis "Converting Jupyter Notebooks")