guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

113/242: gnu: python-nbconvert: Update to 6.5.0.


From: guix-commits
Subject: 113/242: gnu: python-nbconvert: Update to 6.5.0.
Date: Wed, 11 May 2022 18:03:00 -0400 (EDT)

apteryx pushed a commit to branch wip-ipython-polyglossia
in repository guix.

commit c4d9800fcac8ee446d262f6f0ac1b87dafee3a1c
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Wed Apr 13 15:50:36 2022 -0400

    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.
---
 gnu/packages/python-xyz.scm | 160 +++++++++++++++++++++++---------------------
 1 file changed, 82 insertions(+), 78 deletions(-)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 77d6b20f75..8c1ed32244 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -174,6 +174,7 @@
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages haskell-xyz)
   #:use-module (gnu packages icu4c)
+  #:use-module (gnu packages inkscape)
   #:use-module (gnu packages image)
   #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages jupyter)
@@ -13577,70 +13578,71 @@ time.")
 (define-public python-nbconvert
   (package
     (name "python-nbconvert")
-    (version "6.0.7")
+    (version "6.5.0")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "nbconvert" version))
        (sha256
         (base32
-         "00lhqaxn481qvk2w5568asqlsnvrw2fm61p1vssx3m7vdnl17g6b"))))
+         "17g9xq4za7vvzml6l6d8zrzknhxsvgx02hymmsw9d1dygbi4cgi2"))))
     (build-system python-build-system)
     (arguments
-     `(#:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'fix-paths-and-tests
-           (lambda _
-             ;; Use pandoc binary from input.
-             (substitute* "nbconvert/utils/pandoc.py"
-               (("'pandoc'") (string-append "'" (which "pandoc") "'")))
-             ;; Same for LaTeX.
-             (substitute* "nbconvert/exporters/pdf.py"
-               (("\"xelatex\"") (string-append "\"" (which "xelatex") "\""))
-               (("\"bibtex\"") (string-append "\"" (which "bibtex") "\"")))
-             ;; Make sure tests are not skipped.
-             (substitute* (find-files "." "test_.+\\.py$")
-               (("@onlyif_cmds_exist\\(('(pandoc|xelatex)'(, )?)+\\)") ""))
-             ;; Pandoc is never missing, disable test.
-             (substitute* "nbconvert/utils/tests/test_pandoc.py"
-               (("import os" all) (string-append all "\nimport pytest"))
-               (("(.+)(def test_pandoc_available)" all indent def)
-                (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
-           (lambda* (#:key tests? inputs outputs #:allow-other-keys)
-             (when tests?
-               ;; Some tests invoke the installed nbconvert binary.
-               (add-installed-pythonpath inputs outputs)
-               ;; Tests depend on templates installed to output.
-               (setenv "JUPYTER_PATH"
-                       (string-append
-                        (assoc-ref outputs "out")
-                        "/share/jupyter:"
-                        (getenv "JUPYTER_PATH")))
-               ;; Some tests need HOME
-               (setenv "HOME" "/tmp")
-               (invoke "pytest" "-vv")))))))
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'fix-paths
+            (lambda* (#:key inputs #:allow-other-keys)
+              ;; Use pandoc binary from input.
+              (substitute* "nbconvert/utils/pandoc.py"
+                (("'pandoc'")
+                 (format #f "~s" (search-input-file inputs "bin/pandoc"))))
+              ;; Same for LaTeX.
+              (substitute* "nbconvert/exporters/pdf.py"
+                (("\"xelatex\"")
+                 (format #f "~s" (search-input-file inputs "bin/xelatex")))
+                (("\"bibtex\"")
+                 (format #f "~s" (search-input-file inputs "bin/bibtex"))))
+              ;; Likewise for Inkscape.
+              (substitute* "nbconvert/preprocessors/svg2pdf.py"
+                (("inkscape_path = which\\(\"inkscape\")")
+                 (format #f "inkscape_path = ~s"
+                         (search-input-file inputs "bin/inkscape"))))))
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                ;; Tests depend on templates installed to output.
+                (setenv "JUPYTER_PATH"
+                        (string-append #$output "/share/jupyter:"
+                                       (getenv "JUPYTER_PATH")))
+                ;; Step outside of the source directory to avoid having both
+                ;; the installed package *and* the package from the source on
+                ;; 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
-     (list pandoc
-           ;; XXX: Disabled, needs substitute*.
-           ;;("inkscape" ,inkscape)
-           ))
-    (native-inputs
-     `(("python-ipykernel" ,python-ipykernel)
-       ;; XXX: Disabled, not in guix.
-       ;;("python-pyppeteer" ,python-pyppeteer)
-       ("python-pytest" ,python-pytest)
-       ("python-pytest-cov" ,python-pytest-cov)
-       ("python-pytest-dependency" ,python-pytest-dependency)))
+     (list inkscape pandoc))
+    (native-inputs
+     (list python-ipykernel
+           ;; Adding ipywidgets would create a cycle.
+           ;;python-ipywidgets
+           ;;python-pyppeteer    ;TODO: package me
+           python-pytest
+           python-pytest-xdist))
     (propagated-inputs
-     (list python-bleach
+     (list python-beautifulsoup4
+           python-bleach
            python-defusedxml
            python-entrypoints
            python-jinja2
@@ -13656,37 +13658,39 @@ time.")
            ;; Required, even if [serve] is not used.
            python-tornado-6
            ;; Required at runtime for `jupyter nbconvert --to=pdf`.
-           (texlive-updmap.cfg (list texlive-adjustbox
-                                     texlive-amsfonts
-                                     texlive-booktabs
-                                     texlive-caption
-                                     texlive-enumitem
+           texlive-adjustbox
+           texlive-booktabs
+           texlive-caption
+           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-fonts-rsfs
-                                     texlive-generic-iftex
                                      texlive-jknappen
                                      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-lm
+                                     texlive-lm-math
                                      texlive-mathpazo
-                                     texlive-stringenc
-                                     texlive-tcolorbox
-                                     texlive-titling
-                                     texlive-tools
-                                     texlive-ulem
-                                     texlive-xcolor
+                                     texlive-oberdiek
                                      texlive-zapfding))))
     (home-page "https://jupyter.org";)
     (synopsis "Converting Jupyter Notebooks")



reply via email to

[Prev in Thread] Current Thread [Next in Thread]