gnu: perl-http-message: Update to 6.15.
[jackhill/guix/guix.git] / gnu / packages / python.scm
index 064d790..f3a75c3 100644 (file)
@@ -7,7 +7,7 @@
 ;;; Copyright © 2014, 2015 Federico Beffa <beffa@fbengineering.ch>
 ;;; Copyright © 2015 Omar Radwan <toxemicsquire4@gmail.com>
 ;;; Copyright © 2015 Pierre-Antoine Rault <par@rigelk.eu>
-;;; Copyright © 2015, 2016, 2017 Ricardo Wurmus <rekado@elephly.net>
+;;; Copyright © 2015, 2016, 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2015, 2016 Christopher Allan Webber <cwebber@dustycloud.org>
 ;;; Copyright © 2015 Eric Dvorsak <eric@dvorsak.fr>
 ;;; Copyright © 2015, 2016 David Thompson <davet@gnu.org>
 
 (define-public python-2.7
   (package
-    (name "python")
+    (name "python2")
     (version "2.7.14")
     (source
      (origin
@@ -338,7 +338,8 @@ data types.")
 
 (define-public python-3.6
   (package (inherit python-2)
-    (version "3.6.3")
+    (name "python")
+    (version "3.6.4")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://www.python.org/ftp/python/"
@@ -351,7 +352,7 @@ data types.")
               (patch-flags '("-p0"))
               (sha256
                (base32
-                "1nl1raaagr4car787a2hmjv2dw6gqny53xfd6wisbgx4r5kxk9yd"))
+                "1fna7g8jxzl4kd2pqmmqhva5724c5m920x3fsrpsgskaylmr76qm"))
               (snippet
                '(begin
                   (for-each delete-file
@@ -359,8 +360,75 @@ data types.")
                               "Lib/ctypes/test/test_win32.py" ; fails on aarch64
                               "Lib/test/test_fcntl.py")) ; fails on aarch64
                   #t))))
-    (arguments (substitute-keyword-arguments (package-arguments python-2)
-                 ((#:tests? _) #t)))
+    (arguments
+     (substitute-keyword-arguments (package-arguments python-2)
+       ((#:tests? _) #t)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (add-after 'unpack 'patch-timestamp-for-pyc-files
+             (lambda _
+               ;; We set DETERMINISTIC_BUILD to only override the mtime when
+               ;; building with Guix, lest we break auto-compilation in
+               ;; environments.
+               (setenv "DETERMINISTIC_BUILD" "1")
+               (substitute* "Lib/py_compile.py"
+                 (("source_stats\\['mtime'\\]")
+                  "(1 if 'DETERMINISTIC_BUILD' in os.environ else source_stats['mtime'])"))
+
+               ;; Use deterministic hashes for strings, bytes, and datetime
+               ;; objects.
+               (setenv "PYTHONHASHSEED" "0")
+
+               ;; Reset mtime when validating bytecode header.
+               (substitute* "Lib/importlib/_bootstrap_external.py"
+                 (("source_mtime = int\\(source_stats\\['mtime'\\]\\)")
+                  "source_mtime = 1"))
+               #t))
+           ;; These tests fail because of our change to the bytecode
+           ;; validation.  They fail because expected exceptions do not get
+           ;; thrown.  This seems to be no problem.
+           (add-after 'unpack 'disable-broken-bytecode-tests
+             (lambda _
+               (substitute* "Lib/test/test_importlib/source/test_file_loader.py"
+                 (("test_bad_marshal")
+                  "disable_test_bad_marshal")
+                 (("test_no_marshal")
+                  "disable_test_no_marshal")
+                 (("test_non_code_marshal")
+                  "disable_test_non_code_marshal"))
+               #t))
+           ;; Unset DETERMINISTIC_BUILD to allow for tests that check that
+           ;; stale pyc files are rebuilt.
+           (add-before 'check 'allow-non-deterministic-compilation
+             (lambda _ (unsetenv "DETERMINISTIC_BUILD") #t))
+           ;; We need to rebuild all pyc files for three different
+           ;; optimization levels to replace all files that were not built
+           ;; deterministically.
+
+           ;; FIXME: Without this phase we have close to 2000 files that
+           ;; differ across different builds of this package.  With this phase
+           ;; there are about 500 files left that differ.
+           (add-after 'install 'rebuild-bytecode
+             (lambda* (#:key outputs #:allow-other-keys)
+               (setenv "DETERMINISTIC_BUILD" "1")
+               (let ((out (assoc-ref outputs "out")))
+                 (for-each
+                  (lambda (opt)
+                    (format #t "Compiling with optimization level: ~a\n"
+                            (if (null? opt) "none" (car opt)))
+                    (for-each (lambda (file)
+                                (apply invoke
+                                       `(,(string-append out "/bin/python3")
+                                         ,@opt
+                                         "-m" "compileall"
+                                         "-f" ; force rebuild
+                                         ;; Don't build lib2to3, because it's Python 2 code.
+                                         ;; Also don't build obviously broken test code.
+                                         "-x" "(lib2to3|test/bad.*)"
+                                         ,file)))
+                              (find-files out "\\.py$")))
+                  (list '() '("-O") '("-OO")))
+                 #t)))))))
     (native-search-paths
      (list (search-path-specification
             (variable "PYTHONPATH")
@@ -379,7 +447,7 @@ data types.")
 
 (define-public python2-minimal
   (package (inherit python-2)
-    (name "python-minimal")
+    (name "python2-minimal")
     (outputs '("out"))
 
     ;; Keep zlib, which is used by 'pip' (via the 'zipimport' module), which
@@ -1026,7 +1094,7 @@ from the Python interpreter, or as a small part of a larger application.")
        (modify-phases %standard-phases
          (replace 'check
            (lambda _
-             (zero? (system* "py.test" "-v")))))))
+             (invoke "py.test" "-v"))))))
     (native-inputs
      `(("python-py" ,python-py)
        ("python-pytest" ,python-pytest-bootstrap)))
@@ -1935,14 +2003,14 @@ something else) to Python data-types.")
 (define-public python-kitchen
   (package
     (name "python-kitchen")
-    (version "1.2.4")
+    (version "1.2.5")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "kitchen" version))
        (sha256
         (base32
-         "0ggv3p4x8jvmmzhp0xm00h6pvh1g0gmycw71rjwagnrj8n23vxrq"))))
+         "1zakh6l0yjvwic9p0nkvmbidpnkygkxbigh2skmb5gccyrhbp7xg"))))
     (build-system python-build-system)
     (propagated-inputs
      `(("python-chardet" ,python-chardet)))
@@ -3187,7 +3255,8 @@ that client code uses to construct the grammar directly in Python code.")
            ;; input since it would create a circular dependency: Extend the
            ;; test for Python 3, where it is already dropped, to Python 2.
            (substitute* "numpydoc/tests/test_plot_directive.py"
-             (("3") "2"))))))
+             (("3") "2"))
+           #t))))
     (build-system python-build-system)
     (propagated-inputs
      `(("python-sphinx" ,python-sphinx)))
@@ -3806,6 +3875,7 @@ Python's distutils.")
        (uri (git-reference
              (url "https://github.com/dieterv/elib.intl.git")
              (commit "d09997cfef")))
+       (file-name (string-append name "-" version "-checkout"))
        (sha256
         (base32
          "0y7vzff9xgbnaay7m0va1arl6g68ncwrvbgwl7jqlclsahzzb09d"))))
@@ -5066,6 +5136,17 @@ more advanced mathematics.")
        (sha256
         (base32 "190n29sppw7g8ihilc5451y7jlfcaw56crqiqbf1jff43dlmfnxc"))))
     (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         ;; Run the core tests after installation.  By default it would run
+         ;; *all* tests, which take a very long time to complete and are known
+         ;; to be flaky.
+         (delete 'check)
+         (add-after 'install 'check
+           (lambda* (#:key outputs #:allow-other-keys)
+             (invoke "python3" "-c" "import sympy; sympy.test(\"/core\")")
+             #t)))))
     (propagated-inputs
      `(("python-mpmath" ,python-mpmath)))
     (home-page "http://www.sympy.org/")
@@ -5077,7 +5158,19 @@ as possible in order to be comprehensible and easily extensible.")
     (license license:bsd-3)))
 
 (define-public python2-sympy
-  (package-with-python2 python-sympy))
+  (package
+    (inherit (package-with-python2 python-sympy))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         ;; Run the core tests after installation.  By default it would run
+         ;; *all* tests, which take a very long time to complete and are known
+         ;; to be flaky.
+         (delete 'check)
+         (add-after 'install 'check
+           (lambda* (#:key outputs #:allow-other-keys)
+             (invoke "python" "-c" "import sympy; sympy.test(\"/core\")")
+             #t)))))))
 
 (define-public python-q
   (package
@@ -5557,14 +5650,14 @@ Python.")
 (define-public python-markdown
   (package
     (name "python-markdown")
-    (version "2.6.8")
+    (version "2.6.11")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "Markdown" version))
        (sha256
         (base32
-         "0cqfhr1km2s5d8jm6hbwgkrrj9hvkjf2gab3s2axlrw1clgaij0a"))))
+         "108g80ryzykh8bj0i7jfp71510wrcixdi771lf2asyghgyf8cmm8"))))
     (build-system python-build-system)
     (arguments
      `(#:phases
@@ -5743,7 +5836,7 @@ from an XML-based format.")
 (define-public python-ly
   (package
     (name "python-ly")
-    (version "0.9.4")
+    (version "0.9.5")
     (source
      (origin
        (method url-fetch)
@@ -5752,7 +5845,7 @@ from an XML-based format.")
                            "/python-ly-" version ".tar.gz"))
        (sha256
         (base32
-         "0g6n288l83sfwavxh1aryi0aqvsr3sp7v6f903mckwqa4scpky62"))))
+         "0x98dv7p8mg26p4816yy8hz4f34zf6hpnnfmr56msgh9jnsm2qfl"))))
     (build-system python-build-system)
     (arguments
      ;; FIXME: Some tests need network access.
@@ -5869,6 +5962,25 @@ reading and writing MessagePack data.")
     (home-page "https://pypi.python.org/pypi/msgpack/")
     (license license:asl2.0)))
 
+;; This msgpack library's name changed from "python-msgpack" to "msgpack" with
+;; release 0.5. Some packages like borg still call it by the old name for now.
+;; <https://bugs.gnu.org/30662>
+(define-public python-msgpack-transitional
+  (package
+    (inherit python-msgpack)
+    (name "python-msgpack-transitional")
+    (arguments
+     (substitute-keyword-arguments (package-arguments python-msgpack)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (add-after 'unpack 'configure-transitional
+             (lambda _
+               ;; Keep using the old name.
+               (substitute* "setup.py"
+                 (("TRANSITIONAL = False")
+                   "TRANSITIONAL = 1"))
+               #t))))))))
+
 (define-public python2-msgpack
   (package-with-python2 python-msgpack))
 
@@ -6090,13 +6202,13 @@ implementations of ASN.1-based codecs and protocols.")
 (define-public python-ipaddress
   (package
     (name "python-ipaddress")
-    (version "1.0.18")
+    (version "1.0.19")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "ipaddress" version))
               (sha256
                (base32
-                "1q8klj9d84cmxgz66073x1j35cplr3r77vx1znhxiwl5w74391ax"))))
+                "10agaa1cys1bk1ycpl2w8lky9vjx8h1xh1z29mg0niqx0638c390"))))
     (build-system python-build-system)
     (home-page "https://github.com/phihag/ipaddress")
     (synopsis "IP address manipulation library")
@@ -7189,13 +7301,13 @@ Abstract Syntax Tree.")
 (define-public python-rply
   (package
     (name "python-rply")
-    (version "0.7.4")
+    (version "0.7.5")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "rply" version))
               (sha256
                (base32
-                "12rp1d9ba7nvd5rhaxi6xzx1rm67r1k1ylsrkzhpwnphqpb06cvj"))))
+                "0lv428895zxsz43968qx0q9bimwqnfykndz4dpjbq515w2gvzhjh"))))
     (build-system python-build-system)
     (propagated-inputs
      `(("python-appdirs" ,python-appdirs)))
@@ -7365,14 +7477,14 @@ concurrent.futures package from Python 3.2")
 (define-public python-colorama
   (package
    (name "python-colorama")
-   (version "0.3.7")
+   (version "0.3.9")
    (source
     (origin
      (method url-fetch)
      (uri (pypi-uri "colorama" version))
      (sha256
       (base32
-       "0avqkn6362v7k2kg3afb35g4sfdvixjgy890clip4q174p9whhz0"))))
+       "1wd1szk0z3073ghx26ynw43gnc140ibln1safgsis6s6z3s25ss8"))))
    (build-system python-build-system)
    (synopsis "Colored terminal text rendering for Python")
    (description "Colorama is a Python library for rendering colored terminal
@@ -7468,14 +7580,14 @@ servers.")
 (define-public python-jmespath
   (package
    (name "python-jmespath")
-   (version "0.9.0")
+   (version "0.9.3")
    (source
     (origin
      (method url-fetch)
      (uri (pypi-uri "jmespath" version))
      (sha256
       (base32
-       "0g9xvl69y7nr3w7ag4fsp6sm4fqf6vrqjw7504x2hzrrsh3ampq8"))))
+       "0r7wc7fsxmlwzxx9j1j7rms06c6xs6d4sysirdhz1jk2mb4x90ba"))))
    (build-system python-build-system)
    (native-inputs
     `(("python-nose" ,python-nose)))
@@ -8567,12 +8679,12 @@ own code, responding to click events and updating clock every second.")
 (define-public python-tblib
   (package
     (name "python-tblib")
-    (version "1.3.0")
+    (version "1.3.2")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "tblib" version))
               (sha256 (base32
-                       "02iahfkfa927hb4jq2bak36ldihwapzacfiq5lyxg8llwn98a1yi"))))
+                       "1rsg8h069kqgncyv8fgzyj6qflk6j10cb78pa5jk34ixwq044vj3"))))
     (build-system python-build-system)
     (arguments
      `(#:phases
@@ -9334,21 +9446,29 @@ etc.")
 (define-public python-stem
   (package
     (name "python-stem")
-    (version "1.5.4")
+    (version "1.6.0")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "stem" version))
        (sha256
         (base32
-         "1j7pnblrn0yr6jmxvsq6y0ihmxmj5x50jl2n2606w67f6wq16j9n"))))
+         "1va9p3ij7lxg6ixfsvaql06dn11l3fgpxmss1dhlvafm7sqizznp"))))
     (build-system python-build-system)
     (arguments
      `(#:phases
        (modify-phases %standard-phases
+         (add-before 'check 'fix-test-environment
+           (lambda _
+             ;; Fixes: FileNotFoundError: [Errno 2] No such file or directory:
+             ;; '/tmp/guix-build-python-stem-1.6.0.drv-0/stem-1.6.0/.gitignore'.
+             (with-output-to-file ".gitignore"
+               (lambda _ (format #t "%")))
+             #t))
          (replace 'check
            (lambda _
-             (zero? (system* "./run_tests.py" "--unit")))))))
+             (invoke "./run_tests.py" "--unit")
+             #t)))))
     (native-inputs
      `(("python-mock" ,python-mock)
        ("python-pep8" ,python-pep8)
@@ -10147,14 +10267,14 @@ network.")
 (define-public python-xopen
   (package
     (name "python-xopen")
-    (version "0.1.1")
+    (version "0.3.2")
     (source
       (origin
         (method url-fetch)
         (uri (pypi-uri "xopen" version))
         (sha256
           (base32
-           "1wx6mylzcsyhjl19ycb83qq6iqpmr927lz62njfsar6ldsj0qcni"))
+           "0bzjmn3rl1cd3d2q39cjwnkhaspk2b0hfj3rl64pclm44ihg5fb6"))
         (file-name (string-append name "-" version ".tar.gz"))))
     (build-system python-build-system)
     (home-page "https://github.com/marcelm/xopen/")
@@ -10382,14 +10502,14 @@ convering text with ANSI color codes to HTML or LaTeX.")
 (define-public python-ddt
   (package
     (name "python-ddt")
-    (version "1.1.1")
+    (version "1.1.2")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "ddt" version))
        (sha256
         (base32
-         "1c00ikkxr7lha97c81k938bzhgd4pbwamkjn0h4nkhr3xk00zp6n"))))
+         "1wqkmz0yhanly8sif5vb02p2iik7mwxwph8ywph2kbb8ws8szdpx"))))
     (build-system python-build-system)
     (native-inputs
      `(("python-mock" ,python-mock)
@@ -10400,8 +10520,9 @@ convering text with ANSI color codes to HTML or LaTeX.")
     (home-page "https://github.com/txels/ddt")
     (synopsis "Data-Driven Tests")
     (description
-     "DDT (Data-Driven Tests) allows you to multiply one test case by running
-it with different test data, and make it appear as multiple test cases.")
+     "Data-Driven Tests (@dfn{DDT}) allow you to multiply one test case by
+running it with different test data, and make it appear as multiple test
+cases.")
     (license license:expat)))
 
 (define-public python2-ddt
@@ -10964,6 +11085,7 @@ exception message with a traceback that points to the culprit.")
        ;; The PyPI version wouldn't contain tests.
        (uri (string-append "https://github.com/mwclient/mwclient/archive/"
                            "v" version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
        (sha256
         (base32
          "1jj0yhilkjir00719fc7w133x7hdyhkxhk6xblla4asig45klsfv"))))
@@ -12029,14 +12151,14 @@ ignoring formatting changes.")
 (define-public python-tqdm
   (package
     (name "python-tqdm")
-    (version "4.19.5")
+    (version "4.19.6")
     (source
       (origin
         (method url-fetch)
         (uri (pypi-uri "tqdm" version))
          (sha256
            (base32
-             "0xvkffm77nqckk29xjy5fkqvig5b97vk7nzafp3cn36w4zqyccnz"))))
+             "1pw0ngm0zn9papdmkwipi3yih5c3di6d0w849bdmrraq4d2d9h2y"))))
     (build-system python-build-system)
     (native-inputs
      `(("python-flake8" ,python-flake8)
@@ -12212,6 +12334,7 @@ executed more than a given number of times during a given period.")
        (method url-fetch)
        (uri (string-append "https://github.com/kovidgoyal/dukpy/archive/v"
                            version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
        (sha256
         (base32
          "0pj39rfwlzivqm5hkrsza7gssg6ggpxlq5ivc8f3h7x5pfgc6y6c"))))
@@ -12707,7 +12830,6 @@ functions by partial application of operators.")
              (invoke "py.test"))))))
     (native-inputs
      `(("python-pytest" ,python-pytest)
-       ("python-pytest-warnings" ,python-pytest-warnings)
        ("python-whatever" ,python-whatever)))
     (home-page "http://github.com/Suor/funcy")
     (synopsis "Functional tools")
@@ -12940,3 +13062,59 @@ filesystem events on Linux.")
 
 (define-public python2-pyinotify
   (package-with-python2 python-pyinotify))
+
+;; Ada parser uses this version.
+(define-public python2-quex-0.67.3
+  (package
+    (name "python2-quex")
+    (version "0.67.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "mirror://sourceforge/quex/HISTORY/"
+                           (version-major+minor version)
+                           "/quex-" version ".zip"))
+       (sha256
+        (base32
+         "14gv8ll3ipqv4kyc2xiy891nrmjl4ic823zfyx8hassagyclyppw"))))
+    (build-system python-build-system)
+    (native-inputs
+     `(("unzip" ,unzip)))
+    (arguments
+     `(#:python ,python-2
+       #:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (delete 'build)
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (share/quex (string-append out "/share/quex"))
+                    (bin (string-append out "/bin")))
+               (copy-recursively "." share/quex)
+               (mkdir-p bin)
+               (symlink (string-append share/quex "/quex-exe.py")
+                        (string-append bin "/quex"))
+               #t))))))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "QUEX_PATH")
+            (files '("share/quex")))))
+    (home-page "http://quex.sourceforge.net/")
+    (synopsis "Lexical analyzer generator in Python")
+    (description "@code{quex} is a lexical analyzer generator in Python.")
+    (license license:lgpl2.1+)))        ; Non-military
+
+(define-public python2-quex
+  (package (inherit python2-quex-0.67.3)
+    (name "python2-quex")
+    (version "0.68.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "mirror://sourceforge/quex/DOWNLOAD/quex-" version ".tar.gz"))
+       (sha256
+        (base32
+         "0svc9nla3b9145d6b7fb9dizx412l3difzqw0ilh9lz52nsixw8j"))
+       (file-name (string-append name "-" version ".tar.gz"))))))