Merge branch 'master' into core-updates-frozen
[jackhill/guix/guix.git] / gnu / packages / python-web.scm
index 302e5d6..9c8e328 100644 (file)
@@ -1,6 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 Eric Dvorsak <eric@dvorsak.fr>
-;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2017 Christopher Baines <mail@cbaines.net>
 ;;; Copyright © 2016, 2017 Danny Milosavljevic <dannym+a@scratchpost.org>
 ;;; Copyright © 2013, 2014, 2015, 2016, 2020 Andreas Enge <andreas@enge.fr>
@@ -65,6 +65,7 @@
   #:use-module (guix download)
   #:use-module (guix git-download)
   #:use-module (guix build-system python)
+  #:use-module (guix gexp)
   #:use-module (guix utils)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
@@ -194,12 +195,9 @@ API rules.")
                 (string-append "@pytest.mark.xfail\n" all)))
 
              ;; Don't test the aiohttp pytest plugin to avoid a dependency loop.
-             (delete-file "tests/test_pytest_plugin.py")
-             #t))
+             (delete-file "tests/test_pytest_plugin.py")))
          (replace 'check
            (lambda* (#:key tests? #:allow-other-keys)
-             (setenv "PYTHONPATH"
-                     (string-append ".:" (getenv "PYTHONPATH")))
              (if tests?
                  (invoke "pytest" "-vv"
                          ;; Disable loading the aiohttp coverage plugin
@@ -334,9 +332,6 @@ comes with a SOCKS proxy client.")
      '(#:phases (modify-phases %standard-phases
                   (replace 'check
                     (lambda _
-                      (setenv "PYTHONPATH"
-                              (string-append "./build/lib:"
-                                             (getenv "PYTHONPATH")))
                       (invoke "pytest" "-vv"))))))
     (native-inputs
      `(("python-pytest" ,python-pytest)
@@ -448,9 +443,6 @@ Model} (SAM) templates into AWS CloudFormation templates.")
                                   "tests/ext/aiohttp/test_client.py"))))
                   (replace 'check
                     (lambda _
-                      (setenv "PYTHONPATH"
-                              (string-append "./build/lib:.:"
-                                             (getenv "PYTHONPATH")))
                       (invoke "pytest" "-vv" "tests"))))))
     (native-inputs
      `(;; These are required for the test suite.
@@ -502,11 +494,6 @@ emit information from within their applications to the AWS X-Ray service.")
                          "test/unit/module/maintenance/test_update_documentation.py")
                         (delete-file
                          "test/unit/module/maintenance/test_update_resource_specs.py")
-                        (setenv "PYTHONPATH"
-                                (string-append "./build/lib:"
-                                               (getenv "PYTHONPATH")))
-                        (setenv "PATH" (string-append out "/bin:"
-                                                      (getenv "PATH")))
                         (invoke "python" "-m" "unittest" "discover" "-v"
                                 "-s" "test")))))))
     (native-inputs
@@ -789,9 +776,6 @@ content using a variety of algorithms.")
      `(#:phases (modify-phases %standard-phases
                   (replace 'check
                     (lambda _
-                      (setenv "PYTHONPATH"
-                              (string-append "./build/lib:"
-                                             (getenv "PYTHONPATH")))
                       (invoke "pytest" "-vv"
                               ;; Prevent running the flake8 and black
                               ;; pytest plugins, which only tests style
@@ -1194,7 +1178,8 @@ and written in Python.")
      `(("libxml2" ,libxml2)))
     (propagated-inputs
      `(("python-lxml" ,python-lxml)
-       ("python-beautifulsoup4" ,python-beautifulsoup4)))
+       ("python-beautifulsoup4" ,python-beautifulsoup4)
+       ("python-chardet" ,python-chardet)))
     (home-page "https://html5-parser.readthedocs.io")
     (synopsis "Fast C-based HTML5 parsing for Python")
     (description "This package provides a fast implementation of the HTML5
@@ -1484,9 +1469,6 @@ another XPath engine to find the matching elements in an XML or HTML document.")
      `(#:phases (modify-phases %standard-phases
                   (replace 'check
                     (lambda _
-                      (setenv "PYTHONPATH"
-                              (string-append "./build/lib:"
-                                             (getenv "PYTHONPATH")))
                       (invoke "pytest" "tests" "-vv"
                               ;; XXX: This fails with newer Pytest
                               ;; (upstream uses Pytest 3..).
@@ -2789,15 +2771,14 @@ authenticated session objects providing things like keep-alive.")
 (define-public python-urllib3
   (package
     (name "python-urllib3")
-    (version "1.26.2")
+    (version "1.26.4")
     (source
       (origin
         (method url-fetch)
         (uri (pypi-uri "urllib3" version))
         (sha256
          (base32
-          "024yldjwjavps39yb77sc422z8fa9bn20wcqrcncjwrqjab8y60r"))))
-    (replacement python-urllib3/fixed)
+          "0dw9w9bs3hmr5dp3r3h43jyzzb1g1046ag7lj8pqf58i4kvj3c77"))))
     (build-system python-build-system)
     (arguments `(#:tests? #f))
     (propagated-inputs
@@ -2816,18 +2797,6 @@ supports url redirection and retries, and also gzip and deflate decoding.")
     (properties `((python2-variant . ,(delay python2-urllib3))))
     (license license:expat)))
 
-(define python-urllib3/fixed
-  (package
-    (inherit python-urllib3)
-    (version "1.26.4")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (pypi-uri "urllib3" version))
-       (sha256
-        (base32
-         "0dw9w9bs3hmr5dp3r3h43jyzzb1g1046ag7lj8pqf58i4kvj3c77"))))))
-
 ;; Some software requires an older version of urllib3, notably Docker.
 (define-public python-urllib3-1.24
   (package (inherit python-urllib3)
@@ -2976,22 +2945,21 @@ minimum of WSGI.")
 (define-public python-flask
   (package
     (name "python-flask")
-    (version "1.1.2")
+    (version "2.0.1")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "Flask" version))
               (sha256
                (base32
-                "0q3h295izcil7lswkzfnyg3k5gq4hpmqmpl6i7s5m1n9szi1myjf"))))
+                "0mcgwq7b4qd99mf5bsvs3wphchxarf8kgil4hwww3blj31xjak0w"))))
     (build-system python-build-system)
     (arguments
      '(#:phases
        (modify-phases %standard-phases
          (replace 'check
-           (lambda _
-             (setenv "PYTHONPATH" (string-append "./build/lib:"
-                                                 (getenv "PYTHONPATH")))
-             (invoke "pytest" "-vv" "tests"))))))
+           (lambda* (#:key tests? #:allow-other-keys)
+             (when tests?
+               (invoke "pytest" "-vv" "tests")))))))
     (native-inputs
      `(("python-pytest" ,python-pytest)))
     (propagated-inputs
@@ -3023,8 +2991,6 @@ presume or force a developer to use a particular tool or library.")
        (modify-phases %standard-phases
          (replace 'check
            (lambda _
-             (setenv "PYTHONPATH" (string-append "./build/lib:"
-                                                 (getenv "PYTHONPATH")))
              (invoke "pytest" "-vv"))))))
     (propagated-inputs
      `(("python-flask-babel" ,python-flask-babel)
@@ -3798,13 +3764,9 @@ for Flask.")
                     (lambda _
                       ;; This test requires 'postcss' and 'babel' which are
                       ;; not yet available in Guix.
-                      (delete-file "tests/test_filters.py")
-                      #t))
+                      (delete-file "tests/test_filters.py")))
                   (replace 'check
                     (lambda _
-                      (setenv "PYTHONPATH"
-                              (string-append "./build/lib:"
-                                             (getenv "PYTHONPATH")))
                       (invoke "pytest" "-vv"))))))
     (native-inputs
      `(("python-jinja2" ,python-jinja2)
@@ -4098,28 +4060,31 @@ List.  Forked from and using the same API as the publicsuffix package.")
 (define-public python-werkzeug
   (package
     (name "python-werkzeug")
-    (version "1.0.1")
+    (version "2.0.1")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "Werkzeug" version))
        (sha256
         (base32
-         "0z74sa1xw5h20yin9faj0vvdbq713cgbj84klc72jr9nmpjv303c"))))
+         "0hlwawnn8c41f254qify5jnjj8xb97n294h09bqimzqhs0qdpq8x"))))
     (build-system python-build-system)
     (arguments
      '(#:phases
        (modify-phases %standard-phases
-         (delete 'check)
-         (add-after 'install 'check
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (add-installed-pythonpath inputs outputs)
-             (invoke "python" "-m" "pytest"))))))
+         (replace 'check
+           (lambda* (#:key tests? inputs outputs #:allow-other-keys)
+             (when tests?
+               (add-installed-pythonpath inputs outputs)
+               (invoke "python" "-m" "pytest"
+                       ;; Test tries to use the network.
+                       "-k not test_reloader_sys_path")))))))
     (propagated-inputs
      `(("python-requests" ,python-requests)))
     (native-inputs
      `(("python-pytest" ,python-pytest)
-       ("python-pytest-timeout" ,python-pytest-timeout)))
+       ("python-pytest-timeout" ,python-pytest-timeout)
+       ("python-pytest-xprocess" ,python-pytest-xprocess)))
     (home-page "https://palletsprojects.com/p/werkzeug/")
     (synopsis "Utilities for WSGI applications")
     (description "One of the most advanced WSGI utility modules.  It includes a
@@ -4308,17 +4273,36 @@ name resolutions asynchronously.")
 (define-public python-yarl
   (package
     (name "python-yarl")
-    (version "1.1.1")
+    (version "1.6.3")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "yarl" version))
        (sha256
         (base32
-         "1s6z13g8vgxfkkqwhn6imnm7pl7ky9arv4jygnn6bcndcbidg7d6"))))
+         "045z4ssg8g5h0qhz8hnx74hswgkndaldqq1xi5l1n5s0j996d44a"))
+       (modules '((guix build utils)))
+       (snippet
+         #~(begin
+             (delete-file "yarl/_quoting_c.c")))))
     (build-system python-build-system)
+    (arguments
+      (list #:tests? #f     ; test suite can't find yarl._quoting_c
+            #:phases
+            #~(modify-phases %standard-phases
+                (add-after 'unpack 'cythonize-code
+                  (lambda _
+                    (invoke "cython" "yarl/_quoting_c.pyx")))
+                (replace 'check
+                  (lambda* (#:key tests? inputs outputs #:allow-other-keys)
+                    (when tests?
+                      (substitute* "setup.cfg"
+                        (("--cov=yarl") ""))
+                      (add-installed-pythonpath inputs outputs)
+                      (invoke "python" "-m" "pytest")))))))
     (native-inputs
-     `(("python-pytest" ,python-pytest)
+     `(("python-cython" ,python-cython)
+       ("python-pytest" ,python-pytest)
        ("python-pytest-runner" ,python-pytest-runner)))
     (propagated-inputs
      `(("python-idna" ,python-idna)
@@ -4361,7 +4345,15 @@ Google search engine.  Its module is called @code{googlesearch}.")
          "1wpbbbxfpy9mwxdy3kn352cb590ladv574j1aa2l4grjdqw3ln05"))))
     (build-system python-build-system)
     (arguments
-     '(#:tests? #f)) ; tests require internet access
+     `(#:tests? #f ; tests require internet access
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-setup-py
+           (lambda _
+             (substitute* "setup.py"
+               (("googleapiclient/discovery_cache")
+                "googleapiclient.discovery_cache"))
+             #t)))))
     (native-inputs
      `(("python-httplib2" ,python-httplib2)
        ("python-six" ,python-six)
@@ -4574,7 +4566,8 @@ Python.")
        (sha256
         (base32 "0w22fapghmzk3xdasc4dn7h8sl58l08d1h5zbf72dh80drv1g9b9"))))
     (propagated-inputs
-     `(("python-unidecode" ,python-unidecode)))
+     `(("python-unidecode" ,python-unidecode)
+       ("python-text-unidecode" ,python-text-unidecode)))
     (arguments
      `(#:phases
        (modify-phases %standard-phases
@@ -4802,14 +4795,11 @@ event loop.  It is implemented in Cython and uses libuv under the hood.")
            (lambda _
              (invoke "make" "-C" "docs" "PAPER=a4" "html" "info")
              (delete-file "docs/build/texinfo/Makefile")
-             (delete-file "docs/build/texinfo/Gunicorn.texi")
-             #t))
+             (delete-file "docs/build/texinfo/Gunicorn.texi")))
          (replace 'check
            (lambda* (#:key tests? #:allow-other-keys)
              (if tests?
                  (begin
-                   (setenv "PYTHONPATH"
-                           (string-append ".:" (getenv "PYTHONPATH")))
                    (invoke "pytest" "-vv"
                            ;; Disable the geventlet tests because eventlet uses
                            ;; dnspython, which does not work in the build
@@ -5439,7 +5429,15 @@ files.")
          (base32
           "03s3ml6sbki24aajllf8aily0xzrn929zxi84p50zkkbikdd4raw"))))
     (build-system python-build-system)
-    (arguments '(#:tests? #f))  ; Tests not included in release tarball.
+    (arguments
+     '(#:tests? #f  ; Tests not included in release tarball.
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-websockets-package-name-requirement
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; Python package names use dot as separator.
+             (substitute* "setup.py"
+               (("websockets/extensions") "websockets.extensions")))))))
     (home-page "https://github.com/aaugustin/websockets")
     (synopsis
      "Python implementation of the WebSocket Protocol (RFC 6455 & 7692)")