gnu: Add python-jupyter-sphinx.
[jackhill/guix/guix.git] / gnu / packages / sphinx.scm
index bdfe82d..1901509 100644 (file)
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2014 David Thompson <davet@gnu.org>
-;;; Copyright © 2015, 2017, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2015, 2017, 2019, 2020, 2021 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2015, 2016, 2017 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
 ;;; Copyright © 2016, 2017, 2018, 2019 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2017 Christopher Allan Webber <cwebber@dustycloud.org>
 ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2019 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2019 Nicolas Goaziou <mail@nicolasgoaziou.fr>
+;;; Copyright © 2019, 2021 Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;;; Copyright © 2019 Alexandros Theodotou <alex@zrythm.org>
 ;;; Copyright © 2019 Brett Gilio <brettg@gnu.org>
+;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
+;;; Copyright © 2021 Eric Bavier <bavier@posteo.net>
+;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2021 Hugo Lecomte <hugo.lecomte@inria.fr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -41,6 +45,8 @@
   #:use-module (gnu packages graphviz)
   #:use-module (gnu packages image)
   #:use-module (gnu packages imagemagick)
+  #:use-module (gnu packages python-build)
+  #:use-module (gnu packages python-crypto)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages time))
 (define-public python-sphinx
   (package
     (name "python-sphinx")
-    (version "3.2.1")
+    (version "3.3.1")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "Sphinx" version))
        (sha256
         (base32
-         "1s70hxhddzf656kmj01lws4cbywgsinbg8750r9ilf7s2sdns79j"))))
+         "0023vc2i29pjxmvdqbz1wdbi7gbj56y1br1b2z8h8wa44li5k38y"))))
     (build-system python-build-system)
     (arguments
      `(#:phases
@@ -102,7 +108,6 @@ sources.")
     (properties `((python2-variant . ,(delay python2-sphinx))))))
 
 ;; Sphinx 2 does not support Python 2, so we stick with this older version here.
-;; Remove this package once python2-pbcore no longer requires it.
 (define-public python2-sphinx
   (let ((base (package-with-python2 (strip-python2-variant python-sphinx))))
     (package
@@ -120,31 +125,32 @@ sources.")
           `(modify-phases ,phases
              (add-before 'check 'disable-broken-tests
                (lambda _
-                 ;; These tests are broken when using Python2:
-                 ;; <https://github.com/sphinx-doc/sphinx/issues/4710>.
-                 (for-each delete-file '("tests/test_api_translator.py"
-                                         "tests/test_setup_command.py"))
-                 #t))))))
+                 (for-each delete-file
+                           ;; These tests are broken when using Python2:
+                           ;; <https://github.com/sphinx-doc/sphinx/issues/4710>.
+                           '("tests/test_api_translator.py"
+                             "tests/test_setup_command.py"
+                             ;; This one fails for unknown reasons.
+                             "tests/test_correct_year.py"))))))))
       (native-inputs `(("python2-mock" ,python2-mock)
                        ("python2-enum34" ,python2-enum34)
                        ,@(package-native-inputs base)))
       ;; Sphinx 2 has some dependencies that do not support Python 2, so
       ;; we keep our own propagated-inputs here instead of inheriting.
-      (propagated-inputs `(("python2-pytz" ,python2-pytz)
-                           ("python2-typing" ,python2-typing)
-                           ("python2-imagesize" ,python2-imagesize)
-                           ("python2-sphinx-alabaster-theme"
-                            ,python2-sphinx-alabaster-theme)
-                           ("python2-babel" ,python2-babel-2.6)
-                           ("python2-snowballstemmer" ,python2-snowballstemmer)
-                           ("python2-docutils" ,python2-docutils-0.14)
-                           ("python2-jinja2" ,python2-jinja2)
-                           ("python2-packaging" ,python2-packaging)
-                           ("python2-pygments" ,python2-pygments)
-                           ("python2-requests" ,python2-requests)
-                           ("python2-six" ,python2-six)
-                           ("python2-sphinxcontrib-websupport"
-                            ,python2-sphinxcontrib-websupport))))))
+      (propagated-inputs
+       `(("python2-pytz" ,python2-pytz)
+         ("python2-typing" ,python2-typing)
+         ("python2-imagesize" ,python2-imagesize)
+         ("python2-sphinx-alabaster-theme" ,python2-sphinx-alabaster-theme)
+         ("python2-babel" ,python2-babel)
+         ("python2-snowballstemmer" ,python2-snowballstemmer)
+         ("python2-docutils" ,python2-docutils-0.14)
+         ("python2-jinja2" ,python2-jinja2)
+         ("python2-packaging" ,python2-packaging)
+         ("python2-pygments" ,python2-pygments)
+         ("python2-requests" ,python2-requests)
+         ("python2-six" ,python2-six)
+         ("python2-sphinxcontrib-websupport" ,python2-sphinxcontrib-websupport))))))
 
 (define-public python-sphinxcontrib-applehelp
   (package
@@ -212,6 +218,28 @@ to code blocks.")
 @url{Devhelp,https://wiki.gnome.org/Apps/Devhelp} documents.")
     (license license:bsd-2)))
 
+(define-public python-sphinxcontrib-github-alt
+  (package
+    (name "python-sphinxcontrib-github-alt")
+    (version "1.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "sphinxcontrib_github_alt" version))
+       (sha256
+        (base32
+         "1x9af78vamjjcdrrhiah3wg613jv7gm8yh9vvqfrmf4vam6mimyg"))))
+    (build-system python-build-system)
+    (propagated-inputs
+     `(("python-docutils" ,python-docutils)
+       ("python-sphinx" ,python-sphinx)))
+    (home-page "https://github.com/jupyter/sphinxcontrib_github_alt")
+    (synopsis "Link to GitHub pages from Sphinx docs")
+    (description
+     "This package lets you link to GitHub issues, pull requests, commits and
+users from Sphinx docs.")
+    (license license:bsd-2)))
+
 (define-public python-sphinxcontrib-htmlhelp
   (package
     (name "python-sphinxcontrib-htmlhelp")
@@ -383,34 +411,46 @@ integrate Sphinx documents in web templates and to handle searches.")
 (define-public python-sphinx-gallery
   (package
     (name "python-sphinx-gallery")
-    (version "0.1.13")
-    (source (origin
-              (method git-fetch)
-              (uri (git-reference
-                     (url "https://github.com/sphinx-gallery/sphinx-gallery")
-                     (commit (string-append "v" version))))
-              (file-name (git-file-name name version))
-              (sha256
-               (base32
-                "14nbqh9krx2l2y2ylbln6l6w8iak3wac1lngvaf278y1cx7685kg"))))
+    (version "0.9.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "sphinx-gallery" version))
+       (sha256
+        (base32 "14zyhr7m92nafhhnzfvnbgkf5m91krd9mjyi24zn59bjq6zyr8hl"))))
     (build-system python-build-system)
     (arguments
-     ;; FIXME: Tests attempt to download <https://docs.python.org/3/objects.inv>,
-     ;; <https://docs.scipy.org/doc/numpy/objects.inv>, and
-     ;; <https://matplotlib.org/objects.inv>.
-     `(#:tests? #f))
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'writable-files-for-tests
+           (lambda _
+             (for-each make-file-writable (find-files "."))))
+         (replace 'check
+           (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+             (when tests?
+               (add-installed-pythonpath inputs outputs)
+               (invoke "python" "-m" "pytest" "--pyargs" "sphinx_gallery" "-k"
+                       (string-append
+                        ;; These tests require online data.
+                        "not test_embed_code_links_get_data"
+                        " and not test_run_sphinx"
+                        ;; AssertionError.
+                        " and not test_embed_links_and_styles"))))))))
     (native-inputs
-     `(("python-pytest-runner" ,python-pytest-runner)))
-    (home-page "https://sphinx-gallery.github.io/")
+     `(("python-joblib" ,python-joblib)
+       ("python-matplotlib" ,python-matplotlib)
+       ("python-numpy" ,python-numpy)
+       ("python-pillow" ,python-pillow)
+       ("python-pytest" ,python-pytest)
+       ("python-pytest-cov" ,python-pytest-cov)
+       ("python-sphinx" ,python-sphinx)))
+    (home-page "https://sphinx-gallery.github.io/stable/index.html")
     (synopsis "Generate an examples gallery automatically")
     (description
      "@code{sphinx_gallery} is a Sphinx extension that builds an HTML version
 from any set of Python scripts and puts it into an examples gallery.")
     (license license:bsd-3)))
 
-(define-public python2-sphinx-gallery
-  (package-with-python2 python-sphinx-gallery))
-
 (define-public python-sphinx-me
   (package
     (name "python-sphinx-me")
@@ -482,6 +522,30 @@ theme for the Sphinx documentation system.  It's the default theme of Sphinx.")
 (define-public python2-sphinx-alabaster-theme
   (package-with-python2 python-sphinx-alabaster-theme))
 
+(define-public python-sphinx-argparse
+  (package
+    (name "python-sphinx-argparse")
+    (version "0.2.5")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "sphinx-argparse" version))
+       (sha256
+        (base32 "05wc8f5hb3jsg2vh2jf7jsyan8d4i09ifrz2c8fp6f7x1zw9iav0"))))
+    (build-system python-build-system)
+    (propagated-inputs
+     `(("python-sphinx" ,python-sphinx)))
+    (native-inputs
+     `(("python-commonmark" ,python-commonmark)
+       ("python-pytest" ,python-pytest)
+       ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)))
+    (home-page "https://github.com/ribozz/sphinx-argparse")
+    (synopsis "Sphinx extension for documenting argparse commands and options")
+    (description
+     "This package is a sphinx extension that automatically documents
+argparse commands and options")
+    (license license:expat)))
+
 (define-public python-sphinx-cloud-sptheme
   (package
     (name "python-sphinx-cloud-sptheme")
@@ -556,18 +620,17 @@ and several other projects.")
 (define-public python-breathe
   (package
     (name "python-breathe")
-    (version "4.22.1")
+    (version "4.30.0")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "breathe" version))
        (sha256
         (base32
-         "0snk538xv60z4vfhl3f7v5g658za7257hddkg07cknkn33k6cjvf"))))
+         "055h95fkdld7s49878fqjx1nri1drj1czc184vrb7i60mf2yqg9n"))))
     (build-system python-build-system)
     (propagated-inputs
      `(("python-docutils" ,python-docutils)
-       ("python-six" ,python-six)
        ("python-sphinx" ,python-sphinx)))
     (home-page "https://github.com/michaeljones/breathe")
     (synopsis "ReStructuredText and Sphinx bridge to Doxygen")
@@ -578,14 +641,13 @@ to be able to read and render the Doxygen xml output.")
 (define-public python-sphinx-intl
   (package
     (name "python-sphinx-intl")
-    (version "2.0.0")
+    (version "2.0.1")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "sphinx-intl" version))
        (sha256
-        (base32
-         "0zbf1bh23b3kza8bnjykmv2k21xmmr4gamhi3lnicnr6ypnrphr5"))))
+        (base32 "1d1q0sanjp4nkfvhsxi75zf3xjyyi8nzxvl3v7l0jy9ld70nwnmj"))))
     (build-system python-build-system)
     (propagated-inputs
      `(("python-sphinx" ,python-sphinx)
@@ -643,3 +705,110 @@ translate and to apply translation to Sphinx generated document.")
 documentation when a change is detected.  It also includes a livereload
 enabled web server.")
     (license license:expat)))
+
+(define-public python-sphinx-autodoc-typehints
+  (package
+    (name "python-sphinx-autodoc-typehints")
+    (version "1.11.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "sphinx-autodoc-typehints" version))
+       (sha256
+        (base32
+         "086v9mg21pvfx0lfqjx2xf36hnzrsripfg345xi59f7xwb9scjr4"))))
+    (build-system python-build-system)
+    (propagated-inputs
+     `(("python-setuptools-scm" ,python-setuptools-scm)
+       ("python-sphinx" ,python-sphinx)))
+    (native-inputs
+     `(("python-dataclasses" ,python-dataclasses)
+       ("python-pytest" ,python-pytest)
+       ("python-sphinx" ,python-sphinx)
+       ("python-sphobjinv" ,python-sphobjinv)
+       ("python-typing-extensions" ,python-typing-extensions)))
+    (home-page "https://pypi.org/project/sphinx-autodoc-typehints/")
+    (synopsis "Type hints for the Sphinx autodoc extension")
+    (description "This extension allows you to use Python 3 annotations for
+documenting acceptable argument types and return value types of functions.")
+    (license license:expat)))
+
+(define-public python-nbsphinx
+  (package
+    (name "python-nbsphinx")
+    (version "0.7.1")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "nbsphinx" version))
+        (sha256
+          (base32
+            "0j56bxdj08vn3q1804qwb1ywhga1mdg1awgm7i64wfpfwi8df2zm"))))
+    (build-system python-build-system)
+    (propagated-inputs
+      `(("python-docutils" ,python-docutils)
+        ("python-jinja2" ,python-jinja2)
+        ("python-nbconvert" ,python-nbconvert)
+        ("python-nbformat" ,python-nbformat)
+        ("python-sphinx" ,python-sphinx)
+        ("python-traitlets" ,python-traitlets)))
+    (home-page "https://nbsphinx.readthedocs.io/")
+    (synopsis "Jupyter Notebook Tools for Sphinx")
+    (description "@code{python-nbsphinx} is a Sphinx extension that
+provides a source parser for @code{*.ipynb} files.  Custom Sphinx
+directives are used to show Jupyter Notebook code cells (and of course
+their results) in both HTML and LaTeX output.  Un-evaluated notebooks
+- i.e. notebooks without stored output cells - will be automatically
+executed during the Sphinx build process.")
+    (license license:expat)))
+
+(define-public python-sphobjinv
+  (package
+    (name "python-sphobjinv")
+    (version "2.0.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "sphobjinv" version))
+       (sha256
+        (base32
+         "126lgm54c94ay3fci512ap4l607gak90pbz0fk98syxvj5izrrzx"))))
+    (build-system python-build-system)
+    (propagated-inputs
+     `(("python-attrs" ,python-attrs)
+       ("python-certifi" ,python-certifi)
+       ("python-fuzzywuzzy" ,python-fuzzywuzzy)
+       ("python-jsonschema" ,python-jsonschema)
+       ("python-levenshtein" ,python-levenshtein)))
+    (home-page "https://github.com/bskinn/sphobjinv")
+    (synopsis "Sphinx cross-reference tool")
+    (description "Sphinx objects.inv inspection/manipulation tool.")
+    (license license:expat)))
+
+(define-public python-jupyter-sphinx
+  (package
+    (name "python-jupyter-sphinx")
+    (version "0.3.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "jupyter_sphinx" version))
+       (sha256
+        (base32
+         "1wma60787m2451nn4bc4jw7bzqksplplb84wqxm34iaw70499z1p"))))
+    (build-system python-build-system)
+    (propagated-inputs
+     `(("python-ipython" ,python-ipython)
+       ("python-ipywidgets" ,python-ipywidgets)
+       ("python-nbconvert" ,python-nbconvert)
+       ("python-nbformat" ,python-nbformat)))
+    (native-inputs
+     `(("python-sphinx" ,python-sphinx)))
+    (home-page "https://github.com/jupyter/jupyter-sphinx/")
+    (synopsis "Jupyter Sphinx Extensions")
+    (description
+     "Jupyter-sphinx is a Sphinx extension that executes embedded code in a
+Jupyter kernel, and embeds outputs of that code in the document.  It has
+support for rich output such as images, LaTeX math and even JavaScript
+widgets, and supports thebelab for live code execution with minimal effort.")
+    (license license:bsd-3)))