Subject: [bug#47906] [PATCH 22/22] gnu: Add spyder.

From: Vinicius Monego <[email-masked]>
Date: Tue, 20 Apr 2021 05:22:46 +0000

* gnu/packages/spyder.scm (spyder): New variable.
---
 gnu/packages/spyder.scm | 110 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 109 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/spyder.scm b/gnu/packages/spyder.scm
index b1b10f6eb8..ee0c0d34dc 100644
--- a/gnu/packages/spyder.scm
+++ b/gnu/packages/spyder.scm
@@ -22,10 +22,17 @@
   #:use-module (guix git-download)
   #:use-module (guix packages)
   #:use-module (gnu packages)
+  #:use-module (gnu packages bioinformatics)
   #:use-module (gnu packages check)
+  #:use-module (gnu packages databases)
+  #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-check)
+  #:use-module (gnu packages python-crypto)
   #:use-module (gnu packages python-science)
-  #:use-module (gnu packages python-xyz))
+  #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages qt)
+  #:use-module (gnu packages sphinx))
 
 (define-public python-spyder-kernels
   (package
@@ -123,3 +130,104 @@ code inside Spyder.")
 Protocol (LSP) on Python, such as document symbol searching and others.")
     (license license:expat)))
 
+(define-public spyder
+  (package
+    (name "spyder")
+    (version "5.0.1")
+    (source
+     (origin
+       ;; There are no tests in the PyPI tarball.
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/spyder-ide/spyder/")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0pn6kl0jw9zcv8lbk1v90rlrvb3mvjvx6g0x55vv5fydn61nadc5"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:tests? #f ;TODO: Enable tests
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'preparations
+           (lambda _
+             ;; Delete bundled dependencies since we have all of them.
+             (delete-file-recursively "external-deps")
+
+             ;; Relax some dependency versions.
+             (substitute* "setup.py" (("jedi==0.17.2") "jedi"))
+             (substitute* "setup.py" (("parso==0.7.0") "parso"))
+             (substitute* "setup.py" (("qdarkstyle==3.0.2") "qdarkstyle"))
+             (substitute* "setup.py" (("'pyqt5<5.13',") ""))
+             (substitute* "setup.py" (("'pyqtwebengine<5.13',") ""))
+             #t))
+         ;; Ensure that QtWebEngineProcess is found by the executable.
+         (add-after 'wrap 'wrap-qt-process-path
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin/spyder"))
+                    (qt-process-path (string-append
+                                      (assoc-ref inputs "qtwebengine")
+                                      "/lib/qt5/libexec/QtWebEngineProcess")))
+               (wrap-program bin
+                 `("QTWEBENGINEPROCESS_PATH" = (,qt-process-path)))
+               #t)))
+         ;; Ensure that icons are found at runtime.
+         (add-after 'install 'wrap-executable
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (wrap-program (string-append out "/bin/spyder")
+                 `("QT_PLUGIN_PATH" prefix
+                   ,(list (string-append (assoc-ref inputs "qtsvg")
+                                         "/lib/qt5/plugins/")))))
+             #t)))))
+    (inputs
+     `(("python-atomicwrites" ,python-atomicwrites)
+       ("python-chardet" ,python-chardet)
+       ("python-cloudpickle" ,python-cloudpickle)
+       ("python-cookiecutter" ,python-cookiecutter)
+       ("python-diff-match-patch"
+        ,python-diff-match-patch)
+       ("python-intervaltree" ,python-intervaltree)
+       ("python-ipython" ,python-ipython)
+       ("python-jedi" ,python-jedi)
+       ("python-jsonschema" ,python-jsonschema)
+       ("python-keyring" ,python-keyring)
+       ("python-language-server"
+        ,python-language-server)
+       ("python-nbconvert" ,python-nbconvert)
+       ("python-numpydoc" ,python-numpydoc)
+       ("python-parso" ,python-parso)
+       ("python-pexpect" ,python-pexpect)
+       ("python-pickleshare" ,python-pickleshare)
+       ("python-psutil" ,python-psutil)
+       ("python-pygments" ,python-pygments)
+       ("python-pylint" ,python-pylint)
+       ("python-pyls-black" ,python-pyls-black)
+       ("python-pyls-spyder" ,python-pyls-spyder)
+       ("python-pyqt" ,python-pyqt)
+       ("python-pyqtwebengine" ,python-pyqtwebengine)
+       ("python-pyxdg" ,python-pyxdg)
+       ("python-pyzmq" ,python-pyzmq)
+       ("python-qdarkstyle" ,python-qdarkstyle)
+       ("python-qstylizer" ,python-qstylizer)
+       ("python-qtawesome" ,python-qtawesome)
+       ("python-qtconsole" ,python-qtconsole)
+       ("python-qtpy" ,python-qtpy)
+       ("python-sphinx" ,python-sphinx)
+       ("python-spyder-kernels" ,python-spyder-kernels)
+       ("python-textdistance" ,python-textdistance)
+       ("python-three-merge" ,python-three-merge)
+       ("python-watchdog" ,python-watchdog)
+       ("qtsvg" ,qtsvg)
+       ("qtwebengine" ,qtwebengine)))
+    (home-page "https://www.spyder-ide.org/")
+    (synopsis "Scientific Python Development Environment")
+    (description
+     "Spyder is a scientific environment written in Python, for Python, and
+designed by and for scientists, engineers and data analysts.  It offers a
+unique combination of the advanced editing, analysis, debugging, and profiling
+functionality of a comprehensive development tool with the data exploration,
+interactive execution, deep inspection, and visualization capabilities of a
+scientific package.")
+    (license license:expat)))
-- 
2.31.1