summary refs log tree commit diff
path: root/gnu/packages/python.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/python.scm')
-rw-r--r--gnu/packages/python.scm1525
1 files changed, 1139 insertions, 386 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 4161cd3480..8326de679d 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -33,7 +33,7 @@
 ;;; Copyright © 2016 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2016, 2017 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2016, 2017 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Copyright © 2016 Thomas Danckaert <post@thomasdanckaert.be>
+;;; Copyright © 2016, 2017 Thomas Danckaert <post@thomasdanckaert.be>
 ;;; Copyright © 2017 Carlo Zancanaro <carlo@zancanaro.id.au>
 ;;; Copyright © 2017 Frederick M. Muriithi <fredmanglis@gmail.com>
 ;;;
@@ -69,6 +69,7 @@
   #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
+  #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gstreamer)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages icu4c)
@@ -77,6 +78,7 @@
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages libffi)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages man)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages networking)
@@ -87,8 +89,10 @@
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages protobuf)
+  #:use-module (gnu packages qt)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages sdl)
+  #:use-module (gnu packages shells)
   #:use-module (gnu packages statistics)
   #:use-module (gnu packages tex)
   #:use-module (gnu packages texinfo)
@@ -444,6 +448,9 @@ instead of @command{python3}.")))
         (base32
          "1w4r09fvn6kd80m5mx4ws1wz100brkaq6hzzpwrns8cgjzjpl6c6"))))
     (build-system python-build-system)
+    (arguments
+     ;; FIXME: some tests does not return and times out.
+     '(#:tests? #f))
     (home-page "https://www.github.com/giampaolo/psutil")
     (synopsis "Library for retrieving information on running processes")
     (description
@@ -462,14 +469,14 @@ pidof, tty, taskset, pmap.")
 (define-public python-passlib
   (package
     (name "python-passlib")
-    (version "1.7.0")
+    (version "1.7.1")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "passlib" version))
        (sha256
         (base32
-         "1vdbqsa1a31s98fxkinl052q8nnpvbxnb83qanxfpi2p6c2zdr0b"))))
+         "1q2khqpj9rlcgdmkypjdq1kswvhjf72bq0zk2cv669cc2dj8z51x"))))
     (build-system python-build-system)
     (native-inputs
      `(("python-nose" ,python-nose)))
@@ -544,6 +551,14 @@ John the Ripper).")
         (base32
          "14k8z7ndc3zk5xivnm4d8lncchx475ll5izpf8vmfbq7rp9yp5rj"))))
     (build-system python-build-system)
+    (arguments
+     '(;; FIXME: One test fails with "EOFError not raised by connect".
+       #:tests? #f))
+       ;; #:phases
+       ;; (modify-phases %standard-phases
+       ;;   (replace 'check
+       ;;     (lambda _
+       ;;       (zero? (system* "python" "test.py")))))))
     (propagated-inputs
      `(("python-pycrypto" ,python-pycrypto)
        ("python-ecdsa" ,python-ecdsa)))
@@ -819,14 +834,14 @@ concepts.")
 (define-public python-netcdf4
   (package
     (name "python-netcdf4")
-    (version "1.2.6")
+    (version "1.2.7")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "netCDF4" version))
        (sha256
         (base32
-         "1qcymsfxsdfr4sx0vl7ih5d14z66k6c9sjy4gb6rjaksk5387zvg"))))
+         "1fllizmnpw0zkzzm4j9pgamarlzfn3kmv9zrm0w65q1y31h9ni0c"))))
     (build-system python-build-system)
     (native-inputs
      `(("python-cython" ,python-cython)))
@@ -1010,6 +1025,40 @@ etc.).  The package is structured to make adding new modules easy.")
             "python"
             (package-inputs pycrypto)))))))
 
+(define-public python-eventlet
+  (package
+    (name "python-eventlet")
+    (version "0.20.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "eventlet" version))
+       (sha256
+        (base32
+         "0f3q55mq4n021wb7qa53pz3ix6i2py64sap66vsaqm2scjw83m9s"))))
+    (build-system python-build-system)
+    (propagated-inputs
+     `(("python-greenlet" ,python-greenlet)))
+    (home-page "http://eventlet.net")
+    (synopsis "Concurrent networking library for Python")
+    (description
+     "Eventlet is a concurrent networking library for Python that
+allows you to change how you run your code, not how you write it.
+It uses @code{epoll} or @code{libevent} for highly scalable non-blocking I/O.
+Coroutines ensure that the developer uses a blocking style of programming
+that is similar to threading, but provide the benefits of non-blocking I/O.
+The event dispatch is implicit, which means you can easily use @code{Eventlet}
+from the Python interpreter, or as a small part of a larger application.")
+  (license license:expat)))
+
+(define-public python2-eventlet
+  (let ((base (package-with-python2
+                (strip-python2-variant python-eventlet))))
+    (package (inherit base)
+      (propagated-inputs
+       `(("python2-enum34" ,python2-enum34)
+         ,@(package-propagated-inputs base))))))
+
 (define-public python-keyring
   (package
     (name "python-keyring")
@@ -1052,6 +1101,9 @@ password storage.")
        (base32
         "0snmb8xffb3vsma0z67i0h0w2g2dy0p3gsgh9gi4i0kgc5l8spqh"))))
     (build-system python-build-system)
+    (native-inputs
+     `(("python-py" ,python-py)
+       ("python-pytest" ,python-pytest)))
     (home-page "http://pypi.python.org/pypi/six/")
     (synopsis "Python 2 and 3 compatibility utilities")
     (description
@@ -1065,7 +1117,7 @@ Python file, so it can be easily copied into your project.")
 (define-public python2-six
   (package-with-python2 python-six))
 
-(define-public python-dateutil-2
+(define-public python-dateutil
   (package
     (name "python-dateutil")
     (version "2.5.3")
@@ -1086,29 +1138,6 @@ Python file, so it can be easily copied into your project.")
 datetime module, available in Python 2.3+.")
     (license license:bsd-3)))
 
-(define-public python2-dateutil-2
-  (package-with-python2 python-dateutil-2))
-
-(define-public python-dateutil
-  (package
-    (name "python-dateutil")
-    (version "1.5") ; last version for python < 3
-    (source
-     (origin
-      (method url-fetch)
-      (uri (string-append "http://labix.org/download/python-dateutil/"
-                          "python-dateutil-" version ".tar.gz"))
-      (sha256
-       (base32
-        "0fqfglhy5khbvsipr3x7m6bcaqljh8xl5cw33vbfxy7qhmywm2n0"))))
-    (build-system python-build-system)
-    (home-page "https://dateutil.readthedocs.io/en/stable/")
-    (synopsis "Extensions to the standard datetime module")
-    (description
-     "The dateutil module provides powerful extensions to the standard
-datetime module, available in Python 2.3+.")
-    (license license:psfl)))
-
 (define-public python2-dateutil
   (package-with-python2 python-dateutil))
 
@@ -1140,21 +1169,20 @@ datetime module, available in Python 2.3+.")
 (define-public python-pandas
   (package
     (name "python-pandas")
-    (version "0.18.1")
+    (version "0.19.2")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append
-              "https://pypi.python.org/packages/11/09/"
-              "e66eb844daba8680ddff26335d5b4fead77f60f957678243549a8dd4830d/"
-              "pandas-" version ".tar.gz"))
+       (uri (pypi-uri "pandas" version))
        (sha256
-        (base32 "1ckpxrvvjj6zxmn68icd9hib8qcpx9b35f6izxnr25br5ilq7r6j"))))
+        (base32 "0540cnbwy2hc4hv2sxfs8i47xi91qzvzxfn80dl785ibiicly3vg"))
+       (patches
+        (search-patches "python-pandas-skip-failing-tests.patch"))))
     (build-system python-build-system)
     (propagated-inputs
      `(("python-numpy" ,python-numpy)
        ("python-pytz" ,python-pytz)
-       ("python-dateutil" ,python-dateutil-2)))
+       ("python-dateutil" ,python-dateutil)))
     (native-inputs
      `(("python-nose" ,python-nose)
        ("python-cython" ,python-cython)))
@@ -1298,6 +1326,15 @@ Python 3.3+.")
        (base32
         "16rmxy9y0qhqqna2v49i7nzwm09as699rbyvh4raw7w602w55c3k"))))
     (build-system python-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'delete-failing-test
+           (lambda _
+             ;; XXX: These tests require locales that are unavailable
+             ;; in the build environment.
+             (delete-file "test/test_DateTimeParserGenerator.py")
+             #t)))))
     (inputs
      `(("icu4c" ,icu4c)))
     (home-page "http://pyicu.osafoundation.org/")
@@ -1730,6 +1767,12 @@ standard library.")
         (base32
          "0561gz2w3i825gyl42mcq14y3dcgkapfiv5zv9a2bz15qxiijl56"))))
     (build-system python-build-system)
+    (arguments
+     ;; FIXME: "ImportError: 'test' module incorrectly imported from
+     ;; '/gnu/store/...-python-pytest-mimimal-3.0.5/lib/python3.5/site-packages'.
+     ;; Expected '/tmp/guix-build-python-py-1.4.31.drv-0/py-1.4.31/py'.
+     ;; Is this module globally installed?"
+     '(#:tests? #f))
     (home-page "http://pylib.readthedocs.org/")
     (synopsis "Python library for parsing, I/O, instrospection, and logging")
     (description
@@ -1928,6 +1971,15 @@ same arguments.")
            (for-each delete-file (find-files "." "\\.pyc$"))
            #t))))
     (build-system python-build-system)
+    (arguments
+     '(#:tests? #f)) ;FIXME: Some tests are failing.
+       ;; #:phases
+       ;; (modify-phases %standard-phases
+       ;;   (delete 'check)
+       ;;   (add-after 'install 'check
+       ;;     (lambda* (#:key inputs outputs #:allow-other-keys)
+       ;;       (add-installed-pythonpath inputs outputs)
+       ;;       (zero? (system* "py.test" "-v")))))
     (native-inputs
      `(("unzip" ,unzip)
        ("python-setuptools-scm" ,python-setuptools-scm)))
@@ -1980,17 +2032,36 @@ subprocess and see the output as well as any file modifications.")
 (define-public python-testtools
   (package
     (name "python-testtools")
-    (version "1.0.0")
+    (version "1.4.0")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append
-             "https://pypi.python.org/packages/source/t/testtools/testtools-"
-             version ".tar.gz"))
+       (uri (pypi-uri "testtools" version))
        (sha256
         (base32
-         "1dyml28ykpl5jb9khdmcdvhy1cxqingys6qvj2k04fzlaj6z3bbx"))))
+         "1vw8yljnd75d396hhw6s2hrf4cclzy845ifd5am0lxsl235z3i8c"))))
     (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-module-imports
+           (lambda _
+             (substitute* "setup.py"
+               (("'unittest2>=0.8.0',") ""))
+             (substitute* '("testtools/testcase.py"
+                            "testtools/testsuite.py"
+                            "testtools/run.py"
+                            "testtools/tests/test_run.py"
+                            "testtools/tests/test_testsuite.py"
+                            "testtools/tests/test_deferredruntest.py")
+               ;; unittest2 is a backport of Python2.7 features to Python 2.4.
+               (("import unittest2 as unittest") "import unittest")
+               (("import unittest2") "import unittest as unittest2")
+               (("from unittest2 import") "from unittest import"))
+             (substitute* "testtools/tests/test_testresult.py"
+               ;; NUL in source code is not allowed (raises ValueError).
+               (("\\x00\\x04") "\\x04"))
+             #t)))))
     (propagated-inputs
      `(("python-mimeparse" ,python-mimeparse)
        ("python-extras" ,python-extras)))
@@ -2106,7 +2177,8 @@ protocol.")
        (uri (pypi-uri "pbr" version))
        (sha256
         (base32
-         "177kd9kbv1hvf2ban7l3x9ymzbi1md4hkaymwbgnz7ihf312hr0q"))))
+         "177kd9kbv1hvf2ban7l3x9ymzbi1md4hkaymwbgnz7ihf312hr0q"))
+       (patches (search-patches "python-pbr-fix-man-page-support.patch"))))
     (build-system python-build-system)
     (arguments
      `(#:tests? #f))
@@ -2161,10 +2233,18 @@ from git information.
         (base32
          "0djxvdwm8s60dbfn7bhf40x6g818p3b3mlwijm1c3bqg7msn271y"))))
     (build-system python-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _
+             (zero? (system* "python" "-m" "testtools.run"
+                             "fixtures.test_suite")))))))
     (propagated-inputs
      `(("python-six" ,python-six)))
     (native-inputs
-     `(("python-pbr-minimal" ,python-pbr-minimal)
+     `(("python-mock" ,python-mock)
+       ("python-pbr-minimal" ,python-pbr-minimal)
        ("python-testtools" ,python-testtools)))
     (home-page "https://launchpad.net/python-fixtures")
     (synopsis "Python test fixture library")
@@ -2190,6 +2270,9 @@ Python tests.")
         (base32
          "1ssqb07c277010i6gzzkbdd46gd9mrj0bi0i8vn560n2k2y4j93m"))))
     (build-system python-build-system)
+    (arguments
+     ;; FIXME: Many tests are failing.
+     '(#:tests? #f))
     (propagated-inputs
      `(("python-fixtures" ,python-fixtures)
        ("python-subunit" ,python-subunit)
@@ -2219,6 +2302,9 @@ have failed since the last commit or what tests are currently failing.")
         (base32
          "01rbr4br4lsk0lwn8fb96zwd2xr4f0mg1w7iq3j11i8f5ig2nqs1"))))
     (build-system python-build-system)
+    (arguments
+     ;; FIXME: 95 tests failed, 539 passed, 6 skipped, 2 errors.
+     '(#:tests? #f))
     (home-page "http://nedbatchelder.com/code/coverage")
     (synopsis "Code coverage measurement for Python")
     (description
@@ -2394,7 +2480,12 @@ is used by the Requests library to verify HTTPS requests.")
                (substitute* "click/_unicodefun.py"
                  (("'locale'")
                   (string-append "'" glibc "/bin/locale'"))))
-             #t)))))
+             #t))
+         (replace 'check
+           (lambda _
+             (zero? (system* "make" "test")))))))
+    (native-inputs
+     `(("python-pytest" ,python-pytest)))
     (home-page "http://click.pocoo.org")
     (synopsis "Command line library for Python")
     (description
@@ -2446,19 +2537,18 @@ installed with a newer @code{pip} or with wheel's own command line utility.")
 (define-public python-requests
   (package
     (name "python-requests")
-    (version "2.9.1")
+    (version "2.13.0")
     (source (origin
              (method url-fetch)
              (uri (pypi-uri "requests" version))
              (sha256
               (base32
-               "0zsqrzlybf25xscgi7ja4s48y2abf9wvjkn47wh984qgs1fq2xy5"))))
+               "1s0wg4any4dsv5l3hqjxqk2zgb7pdbqhy9rhc8kh3aigfq4ws8jp"))))
+    ;; TODO: unbundle urllib3 and chardet.
     (build-system python-build-system)
-    (native-inputs
-     `(("python-py" ,python-py)
-       ("python-pytest" ,python-pytest)
-       ("python-pytest-cov" ,python-pytest-cov)
-       ("python-wheel" ,python-wheel)))
+    (arguments
+     ;; FIXME: Some tests require network access.
+     '(#:tests? #f))
     (home-page "http://python-requests.org/")
     (synopsis "Python HTTP library")
     (description
@@ -2618,6 +2708,35 @@ somewhat intelligeble.")
 (define-public python2-pyjwt
   (package-with-python2 python-pyjwt))
 
+(define-public python-pykka
+  (package
+    (name "python-pykka")
+    (version "1.2.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "Pykka" version))
+       (sha256
+        (base32
+         "049w3r0mdnnw7xv19jiq7rvls9k7xs73x05b4qs5d6z4vvmgyiz8"))))
+    (build-system python-build-system)
+    (native-inputs
+     `(("python-mock" ,python-mock)
+       ("python-nose" ,python-nose)
+       ("python-gevent" ,python-gevent)
+       ("python-eventlet" ,python-eventlet)))
+    (home-page "https://www.pykka.org/")
+    (synopsis "Pykka is a Python implementation of the actor model")
+    (description
+     "Pykka is a Python implementation of the actor model.
+The actor model introduces some simple rules to control the sharing
+of state and cooperation between execution units, which makes it
+easier to build concurrent applications.")
+    (license license:asl2.0)))
+
+(define-public python2-pykka
+  (package-with-python2 python-pykka))
+
 (define-public python-oauthlib
   (package
     (name "python-oauthlib")
@@ -2631,6 +2750,7 @@ somewhat intelligeble.")
     (build-system python-build-system)
     (native-inputs
      `(("python-nose" ,python-nose)
+       ("python-mock" ,python-mock)
        ("python-cryptography" ,python-cryptography)
        ("python-pyjwt" ,python-pyjwt)
        ("python-blinker" ,python-blinker)))
@@ -2647,7 +2767,6 @@ OAuth request-signing logic.")
     (package
       (inherit base)
       (native-inputs `(("python2-unittest2" ,python2-unittest2)
-                       ("python2-mock" ,python2-mock)
                        ,@(package-native-inputs base))))))
 
 (define-public python-itsdangerous
@@ -2794,15 +2913,26 @@ written in pure Python.")
                (base32
                 "0nmqsfmiw4arjxqkmf9z66ml950pcdjk6aq4gin4sywmzdjw5fzp"))))
     (build-system python-build-system)
+    (arguments
+     '(#:tests? #f)) ; FIXME: Python 3 tests are failing.
     (home-page "http://defunkt.io/pystache/")
     (synopsis "Python logic-less template engine")
     (description
      "Pystache is a Python implementation of the framework agnostic,
 logic-free templating system Mustache.")
-    (license license:expat)))
+    (license license:expat)
+    (properties `((python2-variant . ,(delay python2-pystache))))))
 
 (define-public python2-pystache
-  (package-with-python2 python-pystache))
+  (package (inherit (package-with-python2
+                     (strip-python2-variant python-pystache)))
+           (arguments
+            `(#:python ,python-2
+              #:phases
+              (modify-phases %standard-phases
+                (replace 'check
+                  (lambda _
+                    (zero? (system* "python" "test_pystache.py")))))))))
 
 (define-public python-joblib
   (package
@@ -2899,6 +3029,9 @@ reStructuredText.")
         (base32
          "10axnp2wpjnq9g8wg53fx0c70dfxqrz498jyz8mrdx9a3flwir48"))))
     (build-system python-build-system)
+    (arguments
+     ;; FIXME: Tests require sphinx, which depends on this.
+     '(#:tests? #f))
     (home-page "http://pygments.org/")
     (synopsis "Syntax highlighting")
     (description
@@ -2911,30 +3044,56 @@ reStructuredText.")
 (define-public python-sphinx
   (package
     (name "python-sphinx")
-    (version "1.2.3")
+    (version "1.5.1")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append
-             "https://pypi.python.org/packages/source/S/Sphinx/Sphinx-"
-             version ".tar.gz"))
+       (uri (pypi-uri "Sphinx" version))
        (sha256
         (base32
-         "011xizm3jnmf4cvs5i6kgf6c5nn046h79i8j0vd0f27yw9j3p4wl"))))
+         "1i8p9idnli4gr0y4x67yakbdk5w6a0xjzhrg6bg51y9d1fi7fslf"))))
     (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _
+             ;; Requires Internet access.
+             (delete-file "tests/test_build_linkcheck.py")
+             (zero? (system* "make" "test")))))))
     (propagated-inputs
-     `(("python-jinja2" ,python-jinja2)
+     `(("python-imagesize" ,python-imagesize)
+       ("python-sphinx-alabaster-theme"
+        ,python-sphinx-alabaster-theme)
+       ("python-babel" ,python-babel)
+       ("python-snowballstemmer" ,python-snowballstemmer)
        ("python-docutils" ,python-docutils)
-       ("python-pygments" ,python-pygments)))
+       ("python-jinja2" ,python-jinja2)
+       ("python-pygments" ,python-pygments)
+       ("python-requests" ,python-requests)
+       ("python-six" ,python-six)))
+    (native-inputs
+     `(("graphviz" ,graphviz)
+       ("python-html5lib" ,python-html5lib)
+       ("python-mock" ,python-mock)
+       ("python-nose" ,python-nose)))
     (home-page "http://sphinx-doc.org/")
     (synopsis "Python documentation generator")
     (description "Sphinx is a tool that makes it easy to create documentation
 for Python projects or other documents consisting of multiple reStructuredText
 sources.")
-    (license license:bsd-3)))
+    (license license:bsd-3)
+    (properties `((python2-variant . ,(delay python2-sphinx))))))
 
 (define-public python2-sphinx
-  (package-with-python2 python-sphinx))
+  (let ((base (package-with-python2 (strip-python2-variant python-sphinx))))
+    (package
+      (inherit base)
+      (native-inputs `(("python2-mock" ,python2-mock)
+                       ("python2-enum34" ,python2-enum34)
+                       ,@(package-native-inputs base)))
+      (propagated-inputs `(("python2-pytz" ,python2-pytz)
+                       ,@(package-propagated-inputs base))))))
 
 (define-public python-sphinx-rtd-theme
   (package
@@ -2950,6 +3109,9 @@ sources.")
         (base32
          "19nw3rn7awplcdrz63kg1njqwkbymfg9lwn7l2grhdyhyr2gaa8g"))))
     (build-system python-build-system)
+    (arguments '(#:tests? #f)) ; No tests.
+    (propagated-inputs
+     `(("python-sphinx" ,python-sphinx)))
     (home-page "https://github.com/snide/sphinx_rtd_theme/")
     (synopsis "ReadTheDocs.org theme for Sphinx")
     (description "A theme for Sphinx used by ReadTheDocs.org.")
@@ -2971,7 +3133,7 @@ sources.")
          "0bh4lnj2p1nh0wf5pgxgfbrp27xhb1rinahkb5j7s3qprq6qn0sr"))))
     (build-system python-build-system)
     (propagated-inputs
-     `(("python-dateutil" ,python-dateutil-2)
+     `(("python-dateutil" ,python-dateutil)
        ("python-six" ,python-six)))
     (native-inputs
      `(("python-setuptools-scm" ,python-setuptools-scm)))
@@ -3065,7 +3227,7 @@ interested parties to subscribe to events, or \"signals\".")
        ("python-blinker" ,python-blinker)
        ("python-unidecode" ,python-unidecode)
        ("python-six" ,python-six)
-       ("python-dateutil-2" ,python-dateutil-2)))
+       ("python-dateutil" ,python-dateutil)))
     (home-page "http://getpelican.com/")
     (arguments
      `(;; XXX Requires a lot more packages to do unit tests :P
@@ -3106,11 +3268,20 @@ and is very extensible.")
     (build-system python-build-system)
     (arguments
      `(#:phases
-       (alist-cons-before
-        'check 'set-HOME
-        ;; some tests require access to "$HOME"
-        (lambda _ (setenv "HOME" "/tmp"))
-        %standard-phases)))
+       (modify-phases %standard-phases
+         (delete 'check)
+         (add-after 'install 'check
+           ;; Running tests from the source directory requires
+           ;; an "inplace" build with paths relative to CWD.
+           ;; http://scikit-learn.org/stable/developers/advanced_installation.html#testing
+           ;; Use the installed version instead.
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (add-installed-pythonpath inputs outputs)
+             ;; some tests require access to "$HOME"
+             (setenv "HOME" "/tmp")
+             ;; Step out of the source directory just to be sure.
+             (chdir "..")
+             (zero? (system* "nosetests" "-v" "sklearn")))))))
     (inputs
      `(("openblas" ,openblas)))
     (native-inputs
@@ -3142,6 +3313,9 @@ mining and data analysis.")
        (sha256
         (base32 "0jz416fqvpahqyffw8plmszzfj669w8wvf3y9clnr5lr6a7md3kn"))))
     (build-system python-build-system)
+    (arguments
+     ;; TODO: Some tests require running X11 server. Disable them?
+     '(#:tests? #f))
     ;; See DEPENDS.txt for the list of build and run time requiremnts
     (propagated-inputs
      `(("python-matplotlib" ,python-matplotlib)
@@ -3277,24 +3451,26 @@ between language specification and implementation aspects.")
 
 ;; This version of numpy is missing the documentation and is only used to
 ;; build matplotlib which is required to build numpy's documentation.
-(define python-numpy-bootstrap
+(define-public python-numpy
   (package
-    (name "python-numpy-bootstrap")
-    (version "1.10.4")
+    (name "python-numpy")
+    (version "1.12.0")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://sourceforge/numpy/NumPy/" version
-                           "/numpy-" version ".tar.gz"))
+       (uri (string-append
+             "https://github.com/numpy/numpy/archive/v" version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
        (sha256
         (base32
-         "1bjjhvncraka5s6i4lg644jrxij6bvycxy7an20gcz3a0m11iygp"))))
+         "025d4j4aakcp8w5i5diqh812cbbjgac7jszx1j56ivrbi1i8vv7d"))))
     (build-system python-build-system)
     (inputs
      `(("openblas" ,openblas)
        ("lapack" ,lapack)))
     (native-inputs
-     `(("python-nose" ,python-nose)
+     `(("python-cython" ,python-cython)
+       ("python-nose" ,python-nose)
        ("gfortran" ,gfortran)))
     (arguments
      `(#:phases
@@ -3343,8 +3519,8 @@ and Fortran code, useful linear algebra, Fourier transform, and random number
 capabilities.")
     (license license:bsd-3)))
 
-(define python2-numpy-bootstrap
-  (package-with-python2 python-numpy-bootstrap))
+(define-public python2-numpy
+  (package-with-python2 python-numpy))
 
 (define-public python-munch
   (package
@@ -3370,14 +3546,14 @@ objects.")
 (define-public python2-fastlmm
   (package
     (name "python2-fastlmm")
-    (version "0.2.26")
+    (version "0.2.21")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "fastlmm" version ".zip"))
        (sha256
         (base32
-         "0yxrx9xzai4fyrsi7c2p31kxvpq9czmv1p0wax5ic07m6izbszxg"))))
+         "1q8c34rpmwkfy3r4d5172pzdkpfryj561897z9r3x22gq7813x1m"))))
     (build-system python-build-system)
     (arguments
      `(#:python ,python-2)) ; only Python 2.7 is supported
@@ -3391,7 +3567,8 @@ objects.")
     (native-inputs
      `(("unzip" ,unzip)
        ("python2-cython" ,python2-cython)
-       ("python2-mock" ,python2-mock)))
+       ("python2-mock" ,python2-mock)
+       ("python2-nose" ,python2-nose)))
     (home-page "http://research.microsoft.com/en-us/um/redmond/projects/mscompbio/fastlmm/")
     (synopsis "Perform genome-wide association studies on large data sets")
     (description
@@ -3400,69 +3577,83 @@ Models, is a program for performing both single-SNP and SNP-set genome-wide
 association studies (GWAS) on extremely large data sets.")
     (license license:asl2.0)))
 
-(define-public python-numpy
-  (package (inherit python-numpy-bootstrap)
-    (name "python-numpy")
-    (outputs '("out" "doc"))
-    (inputs
-     `(("which" ,which)
-       ,@(package-inputs python-numpy-bootstrap)))
-    (propagated-inputs
-     `(("python-matplotlib" ,python-matplotlib)
-       ("python-pyparsing" ,python-pyparsing)
-       ,@(package-propagated-inputs python-numpy-bootstrap)))
+(define-public python-numpy-documentation
+  (package
+    (name "python-numpy-documentation")
+    (version (package-version python-numpy))
+    (source (package-source python-numpy))
+    (build-system python-build-system)
     (native-inputs
-     `(("pkg-config" ,pkg-config)
+     `(("python-matplotlib" ,python-matplotlib)
+       ("python-numpy" ,python-numpy)
+       ("pkg-config" ,pkg-config)
        ("python-sphinx" ,python-sphinx)
        ("python-numpydoc" ,python-numpydoc)
        ("texlive" ,texlive)
        ("texinfo" ,texinfo)
        ("perl" ,perl)
-       ,@(package-native-inputs python-numpy-bootstrap)))
-    (arguments
-     `(,@(substitute-keyword-arguments
-             (package-arguments python-numpy-bootstrap)
-           ((#:phases phases)
-            `(alist-cons-after
-              'install 'install-doc
-              (lambda* (#:key inputs outputs #:allow-other-keys)
-                ;; Make installed package available for building the
-                ;; documentation
-                (add-installed-pythonpath inputs outputs)
-                (let* ((data (string-append (assoc-ref outputs "doc") "/share"))
-                       (doc (string-append
-                             data "/doc/" ,name "-"
-                             ,(package-version python-numpy-bootstrap)))
-                       (info (string-append data "/info"))
-                       (html (string-append doc "/html"))
-                       (pyver ,(string-append "PYVER=")))
-                  (with-directory-excursion "doc"
-                    (mkdir-p html)
-                    (system* "make" "html" pyver)
-                    (system* "make" "latex" "PAPER=a4" pyver)
-                    (system* "make" "-C" "build/latex"
-                             "all-pdf" "PAPER=a4" pyver)
-                    ;; FIXME: Generation of the info file fails.
-                    ;; (system* "make" "info" pyver)
-                    ;; (mkdir-p info)
-                    ;; (copy-file "build/texinfo/numpy.info"
-                    ;;            (string-append info "/numpy.info"))
-                    (for-each (lambda (file)
-                                (copy-file (string-append "build/latex" file)
-                                           (string-append doc file)))
-                              '("/numpy-ref.pdf" "/numpy-user.pdf"))
-                    (with-directory-excursion "build/html"
-                      (for-each (lambda (file)
-                                  (let* ((dir (dirname file))
-                                         (tgt-dir (string-append html "/" dir)))
-                                    (unless (equal? "." dir)
-                                      (mkdir-p tgt-dir))
-                                    (install-file file html)))
-                                (find-files "." ".*"))))))
-              ,phases)))))))
+       ("scipy-sphinx-theme"
+        ,(origin ; The build script expects scipy-sphinx-theme as a git submodule
+           (method git-fetch)
+           (uri (git-reference
+                 (url "https://github.com/scipy/scipy-sphinx-theme.git")
+                 (commit "c466764e22")))
+           (sha256
+            (base32
+                "0q2y87clwlsgc7wvlsn9pzyssybcq10plwhq2w1ydykfsyyqbmkl"))))
+       ,@(package-native-inputs python-numpy)))
+    (arguments
+     `(#:tests? #f ; we're only generating the documentation
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'build)
+         (replace 'install
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((data (string-append (assoc-ref outputs "out") "/share"))
+                    (doc (string-append
+                          data "/doc/" ,name "-"
+                          ,(package-version python-numpy)))
+                    (info-reader (string-append data "/info"))
+                    (html (string-append doc "/html"))
+                    (scipy-sphinx-theme "scipy-sphinx-theme")
+                    (sphinx-theme-checkout (assoc-ref inputs scipy-sphinx-theme))
+                    (pyver ,(string-append "PYVER=")))
+               (with-directory-excursion "doc"
+                 (copy-recursively sphinx-theme-checkout scipy-sphinx-theme)
+                 (mkdir-p html)
+                 (system* "make" "html" pyver)
+                 (system* "make" "latex" "PAPER=a4" pyver)
+                 (system* "make" "-C" "build/latex"
+                          "all-pdf" "PAPER=a4" pyver)
+                 ;; FIXME: Generation of the info file fails.
+                 ;; (system* "make" "info" pyver)
+                 ;; (mkdir-p info)
+                 ;; (copy-file "build/texinfo/numpy.info"
+                 ;;            (string-append info "/numpy.info"))
+                 (for-each (lambda (file)
+                             (copy-file (string-append "build/latex" file)
+                                        (string-append doc file)))
+                           '("/numpy-ref.pdf" "/numpy-user.pdf"))
+                 (with-directory-excursion "build/html"
+                   (for-each (lambda (file)
+                               (let* ((dir (dirname file))
+                                      (tgt-dir (string-append html "/" dir)))
+                                 (unless (equal? "." dir)
+                                   (mkdir-p tgt-dir))
+                                 (install-file file html)))
+                             (find-files "." ".*")))))
+             #t)))))
+    (home-page (package-home-page python-numpy))
+    (synopsis "Documentation for the python-numpy package")
+    (description (package-description python-numpy))
+    (license (package-license python-numpy))))
 
-(define-public python2-numpy
-  (package-with-python2 python-numpy))
+(define-public python2-numpy-documentation
+  (let ((numpy-documentation (package-with-python2 python-numpy-documentation)))
+    (package
+      (inherit numpy-documentation)
+      (native-inputs `(("python2-functools32" ,python2-functools32)
+                       ,@(package-native-inputs numpy-documentation))))))
 
 (define-public python-pygit2
   (package
@@ -3474,7 +3665,9 @@ association studies (GWAS) on extremely large data sets.")
        (uri (pypi-uri "pygit2" version))
        (sha256
         (base32
-         "0wf5rp0fvrw7j3j18dvwjq6xqlbm611wd55aphrfpps0v1gxh3ny"))))
+         "0wf5rp0fvrw7j3j18dvwjq6xqlbm611wd55aphrfpps0v1gxh3ny"))
+       (patches
+        (search-patches "python-pygit2-disable-network-tests.patch"))))
     (build-system python-build-system)
     (propagated-inputs
      `(("python-six" ,python-six)
@@ -3635,29 +3828,60 @@ To address this and enable easy cycling over arbitrary @code{kwargs}, the
 (define-public python2-cycler
   (package-with-python2 python-cycler))
 
+(define-public python-colorspacious
+  (package
+    (name "python-colorspacious")
+    (version "1.1.0")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append "https://github.com/njsmith/colorspacious/archive/v"
+                            version ".tar.gz"))
+        (file-name (string-append name "-" version))
+        (sha256
+         (base32 "1vflh5jm32qb0skza2i8pjacv09w6gq84fqpp2nj77s0rbmzgr4k"))))
+    (build-system python-build-system)
+    (propagated-inputs
+     `(("python-numpy" ,python-numpy)))
+    (native-inputs
+     `(("python-nose" ,python-nose)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _
+             (zero? (system* "nosetests" "--all-modules" "-v" "colorspacious")))))))
+    (home-page "https://github.com/njsmith/colorspacious")
+    (synopsis "Python library for colorspace conversions")
+    (description "@code{colorspacious} is a Python library that lets you
+convert between colorspaces like sRGB, XYZ, CIEL*a*b*, CIECAM02, CAM02-UCS, etc.")
+    (license license:expat)))
+
+(define-public python2-colorspacious
+  (package-with-python2 python-colorspacious))
+
 (define-public python-matplotlib
   (package
     (name "python-matplotlib")
-    (version "1.4.3")
+    (version "2.0.0")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "mirror://sourceforge/matplotlib/matplotlib"
-                           "/matplotlib-" version
-                           "/matplotlib-" version ".tar.gz"))
+       (uri (string-append
+             "https://github.com/matplotlib/matplotlib/archive/v" version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
        (sha256
         (base32
-         "1dn05cvd0g984lzhh72wa0z93psgwshbbg93fkab6slx5m3l95av"))
-       (patches (search-patches "matplotlib-setupext-tk.patch"))))
+         "0w3k5m5qb3wsd7yhvmg042xddvligklvcq2visk2c5wnph3hhsln"))))
     (build-system python-build-system)
-    (outputs '("out" "doc"))
     (propagated-inputs ; the following packages are all needed at run time
-     `(("python-pyparsing" ,python-pyparsing)
+     `(("python-cycler" ,python-cycler)
+       ("python-pyparsing" ,python-pyparsing)
        ("python-pygobject" ,python-pygobject)
        ("gobject-introspection" ,gobject-introspection)
        ("python-tkinter" ,python "tk")
-       ("python-dateutil" ,python-dateutil-2)
-       ("python-numpy" ,python-numpy-bootstrap)
+       ("python-dateutil" ,python-dateutil)
+       ("python-numpy" ,python-numpy)
        ("python-pillow" ,python-pillow)
        ("python-pytz" ,python-pytz)
        ("python-six" ,python-six)
@@ -3684,75 +3908,34 @@ To address this and enable easy cycling over arbitrary @code{kwargs}, the
        ("glib" ,glib)
        ;; FIXME: Add backends when available.
        ;("python-wxpython" ,python-wxpython)
-       ;("python-pyqt" ,python-pyqt)
+       ("python-pyqt" ,python-pyqt)
        ("tcl" ,tcl)
        ("tk" ,tk)))
     (native-inputs
      `(("pkg-config" ,pkg-config)
-       ("python-sphinx" ,python-sphinx)
-       ("python-numpydoc" ,python-numpydoc)
        ("python-nose" ,python-nose)
-       ("python-mock" ,python-mock)
-       ("texlive" ,texlive)
-       ("texinfo" ,texinfo)))
+       ("python-mock" ,python-mock)))
     (arguments
      `(#:phases
-       (alist-cons-before
-        'build 'configure-environment
-        (lambda* (#:key outputs inputs #:allow-other-keys)
-          (let ((cairo (assoc-ref inputs "cairo"))
-                (gtk+ (assoc-ref inputs "gtk+")))
-            ;; Setting these directories in the 'basedirlist' of 'setup.cfg'
-            ;; has not effect.
-            (setenv "LD_LIBRARY_PATH"
-                    (string-append cairo "/lib:" gtk+ "/lib"))
-            (setenv "HOME" (getcwd))
-            (call-with-output-file "setup.cfg"
-              (lambda (port)
-                (format port "[directories]~%
+       (modify-phases %standard-phases
+         (add-before 'build 'configure-environment
+           (lambda* (#:key outputs inputs #:allow-other-keys)
+             (let ((cairo (assoc-ref inputs "cairo"))
+                   (gtk+ (assoc-ref inputs "gtk+")))
+               ;; Setting these directories in the 'basedirlist' of 'setup.cfg'
+               ;; has not effect.
+               (setenv "LD_LIBRARY_PATH"
+                       (string-append cairo "/lib:" gtk+ "/lib"))
+               (setenv "HOME" (getcwd))
+               (call-with-output-file "setup.cfg"
+                 (lambda (port)
+                   (format port "[directories]~%
 basedirlist = ~a,~a~%
  [rc_options]~%
 backend = TkAgg~%"
                         (assoc-ref inputs "tcl")
-                        (assoc-ref inputs "tk"))))))
-        (alist-cons-after
-         'install 'install-doc
-         (lambda* (#:key inputs outputs #:allow-other-keys)
-           (let* ((data (string-append (assoc-ref outputs "doc") "/share"))
-                  (doc (string-append data "/doc/" ,name "-" ,version))
-                  (info (string-append data "/info"))
-                  (html (string-append doc "/html")))
-             ;; Make installed package available for building the
-             ;; documentation
-             (add-installed-pythonpath inputs outputs)
-             (with-directory-excursion "doc"
-               ;; Produce pdf in 'A4' format.
-               (substitute* (find-files "." "conf\\.py")
-                 (("latex_paper_size = 'letter'")
-                  "latex_paper_size = 'a4'"))
-               (mkdir-p html)
-               (mkdir-p info)
-               ;; The doc recommends to run the 'html' target twice.
-               (system* "python" "make.py" "html")
-               (system* "python" "make.py" "html")
-               (copy-recursively "build/html" html)
-               (system* "python" "make.py" "latex")
-               (system* "python" "make.py" "texinfo")
-               (symlink (string-append html "/_images")
-                        (string-append info "/matplotlib-figures"))
-               (with-directory-excursion "build/texinfo"
-                 (substitute* "matplotlib.texi"
-                   (("@image\\{([^,]*)" all file)
-                    (string-append "@image{matplotlib-figures/" file)))
-                 (symlink (string-append html "/_images")
-                          "./matplotlib-figures")
-                 (system* "makeinfo" "--no-split"
-                          "-o" "matplotlib.info" "matplotlib.texi"))
-               (copy-file "build/texinfo/matplotlib.info"
-                          (string-append info "/matplotlib.info"))
-               (copy-file "build/latex/Matplotlib.pdf"
-                          (string-append doc "/Matplotlib.pdf")))))
-        %standard-phases))))
+                        (assoc-ref inputs "tk")))))
+             #t)))))
     (home-page "http://matplotlib.org")
     (synopsis "2D plotting library for Python")
     (description
@@ -3772,11 +3955,78 @@ toolkits.")
       ;; of those automatically rewritten by package-with-python2.
       (propagated-inputs
        `(("python2-pycairo" ,python2-pycairo)
+         ("python2-functools32" ,python2-functools32)
          ("python2-pygobject-2" ,python2-pygobject-2)
+         ("python2-subprocess32" ,python2-subprocess32)
          ("python2-tkinter" ,python-2 "tk")
          ,@(fold alist-delete (package-propagated-inputs matplotlib)
                  '("python-pycairo" "python-pygobject" "python-tkinter")))))))
 
+(define-public python-matplotlib-documentation
+  (package
+    (name "python-matplotlib-documentation")
+    (version (package-version python-matplotlib))
+    (source (package-source python-matplotlib))
+    (build-system python-build-system)
+    (native-inputs
+     `(("python-matplotlib" ,python-matplotlib)
+       ("python-colorspacious" ,python-colorspacious)
+       ("python-sphinx" ,python-sphinx)
+       ("python-numpydoc" ,python-numpydoc)
+       ("python-ipython" ,python-ipython)
+       ("python-mock" ,python-mock)
+       ("graphviz" ,graphviz)
+       ("texlive" ,texlive)
+       ("texinfo" ,texinfo)
+       ,@(package-native-inputs python-matplotlib)))
+    (arguments
+     `(#:tests? #f ; we're only generating documentation
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           (lambda _
+             (chdir "doc")
+             ;; Produce pdf in 'A4' format.
+             (substitute* "conf.py"
+               (("latex_paper_size = 'letter'") "")
+               ;; latex_paper_size is deprecated -> set paper size using
+               ;; latex_elements
+               (("latex_elements\\['pointsize'\\] = '11pt'" match)
+                ;; insert at a point where latex_elements{} is defined:
+                (string-append match "\nlatex_elements['papersize'] = 'a4paper'")))
+             (zero? (system* "python" "make.py" "html" "latex" "texinfo"))))
+         (replace 'install
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((data (string-append (assoc-ref outputs "out") "/share"))
+                    (doc (string-append data "/doc/python-matplotlib-" ,version))
+                    (info (string-append data "/info"))
+                    (html (string-append doc "/html")))
+               (mkdir-p html)
+               (mkdir-p info)
+               (copy-recursively "build/html" html)
+               (symlink (string-append html "/_images")
+                        (string-append info "/matplotlib-figures"))
+               (with-directory-excursion "build/texinfo"
+                 (substitute* "matplotlib.texi"
+                   (("@image\\{([^,]*)" all file)
+                    (string-append "@image{matplotlib-figures/" file)))
+                 (symlink (string-append html "/_images")
+                          "./matplotlib-figures")
+                 (system* "makeinfo" "--no-split"
+                          "-o" "matplotlib.info" "matplotlib.texi"))
+               (copy-file "build/texinfo/matplotlib.info"
+                          (string-append info "/matplotlib.info"))
+               (copy-file "build/latex/Matplotlib.pdf"
+                          (string-append doc "/Matplotlib.pdf")))
+             #t)))))
+    (home-page (package-home-page python-matplotlib))
+    (synopsis "Documentation for the python-matplotlib package")
+    (description (package-description python-matplotlib))
+    (license (package-license python-matplotlib))))
+
+(define-public python2-matplotlib-documentation
+  (package-with-python2 python-matplotlib-documentation))
+
 (define-public python2-pysnptools
   (package
     (name "python2-pysnptools")
@@ -3820,6 +4070,16 @@ operators such as union, intersection, and difference.")
         (base32
          "0nhan2qvrw7b7gg5zddwa22kybdv3x1g26vkd7q8lvnkgzrs4dga"))))
     (build-system python-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (delete 'check)
+         (add-after 'install 'check
+           (lambda* (#:key outputs inputs #:allow-other-keys)
+             ;; It's easier to run tests after install.
+             ;; Make installed package available for running the tests
+             (add-installed-pythonpath inputs outputs)
+             (zero? (system* "python" "-m" "rpy2.tests" "-v")))))))
     (propagated-inputs
      `(("python-six" ,python-six)))
     (inputs
@@ -3840,23 +4100,23 @@ functions.")
 (define-public python2-rpy2
   (let ((rpy2 (package-with-python2 python-rpy2)))
     (package (inherit rpy2)
-      (native-inputs
+      (propagated-inputs
        `(("python2-singledispatch" ,python2-singledispatch)
-         ,@(package-native-inputs rpy2))))))
+         ,@(package-propagated-inputs rpy2))))))
 
 (define-public python-scipy
   (package
     (name "python-scipy")
-    (version "0.16.0")
+    (version "0.18.1")
     (source
      (origin
        (method url-fetch)
-; http://downloads.sourceforge.net/project/scipy/scipy/0.16.1/scipy-0.16.1.tar.gz
-       (uri (string-append "mirror://sourceforge/scipy/scipy/" version
-                           "/scipy-" version ".tar.xz"))
+       (uri (string-append "https://github.com/scipy/scipy/archive/v"
+                           version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
        (sha256
         (base32
-         "0wa0a4skpda3gx7lb12yn19nhbairlyxrvda2lz2bcawk3x5qzz2"))))
+         "17slsrfawjp7if6qrlx03zhgp05350ginxx8ddpw9zqx43x905sn"))))
     (build-system python-build-system)
     (propagated-inputs
      `(("python-numpy" ,python-numpy)
@@ -3866,22 +4126,22 @@ functions.")
      `(("lapack" ,lapack)
        ("openblas" ,openblas)))
     (native-inputs
-     `(("python-nose" ,python-nose)
+     `(("python-cython" ,python-cython)
+       ("python-nose" ,python-nose)
        ("python-sphinx" ,python-sphinx)
        ("python-numpydoc" ,python-numpydoc)
        ("gfortran" ,gfortran)
-       ("texlive" ,texlive)
        ("perl" ,perl)))
     (outputs '("out" "doc"))
     (arguments
      `(#:phases
-       (alist-cons-before
-        'build 'configure-openblas
-        (lambda* (#:key inputs #:allow-other-keys)
-          (call-with-output-file "site.cfg"
-            (lambda (port)
-              (format port
-                      "[blas]
+       (modify-phases %standard-phases
+         (add-before 'build 'configure-openblas
+           (lambda* (#:key inputs #:allow-other-keys)
+             (call-with-output-file "site.cfg"
+               (lambda (port)
+                 (format port
+                         "[blas]
 libraries = openblas
 library_dirs = ~a/lib
 include_dirs = ~a/include
@@ -3891,62 +4151,59 @@ include_dirs = ~a/include
 library_dirs = ~a/lib
 atlas_libs = openblas
 "
-                      (assoc-ref inputs "openblas")
-                      (assoc-ref inputs "openblas")
-                      (assoc-ref inputs "openblas"))))
-          #t)
-        (alist-cons-after
-         'install 'install-doc
-         (lambda* (#:key inputs outputs #:allow-other-keys)
-           (let* ((data (string-append (assoc-ref outputs "doc") "/share"))
-                  (doc (string-append data "/doc/" ,name "-" ,version))
-                  (html (string-append doc "/html"))
-                  (pyver ,(string-append "PYVER=")))
-             ;; Make installed package available for building the
-             ;; documentation
+                         (assoc-ref inputs "openblas")
+                         (assoc-ref inputs "openblas")
+                         (assoc-ref inputs "openblas"))))
+             #t))
+         (add-after 'install 'install-doc
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((data (string-append (assoc-ref outputs "doc") "/share"))
+                    (doc (string-append data "/doc/" ,name "-" ,version))
+                    (html (string-append doc "/html"))
+                    (pyver ,(string-append "PYVER=")))
+               ;; Make installed package available for building the
+               ;; documentation
+               (add-installed-pythonpath inputs outputs)
+               (with-directory-excursion "doc"
+                 ;; Fix generation of images for mathematical expressions.
+                 (substitute* (find-files "source" "conf\\.py")
+                   (("pngmath_use_preview = True")
+                    "pngmath_use_preview = False"))
+                 (mkdir-p html)
+                 (system* "make" "html" pyver)
+                 (with-directory-excursion "build/html"
+                   (for-each (lambda (file)
+                               (let* ((dir (dirname file))
+                                      (tgt-dir (string-append html "/" dir)))
+                                 (install-file file html)))
+                             (find-files "." ".*")))))
+             #t))
+         (add-after 'unpack 'fix-tests
+           (lambda _
+             (substitute* "scipy/integrate/tests/test_quadpack.py"
+               (("libm.so") "libm.so.6"))
+             #t))
+           ;; Tests can only be run after the library has been installed and not
+           ;; within the source directory.
+         (delete 'check)
+         (add-after 'install 'check
+           (lambda* (#:key inputs outputs #:allow-other-keys)
              (add-installed-pythonpath inputs outputs)
-             (with-directory-excursion "doc"
-               ;; Fix generation of images for mathematical expressions.
-               (substitute* (find-files "source" "conf\\.py")
-                 (("pngmath_use_preview = True")
-                  "pngmath_use_preview = False"))
-               (mkdir-p html)
-               (system* "make" "html" pyver)
-               (system* "make" "latex" "PAPER=a4" pyver)
-               (system* "make" "-C" "build/latex" "all-pdf" "PAPER=a4" pyver)
-               (copy-file "build/latex/scipy-ref.pdf"
-                          (string-append doc "/scipy-ref.pdf"))
-               (with-directory-excursion "build/html"
-                 (for-each (lambda (file)
-                             (let* ((dir (dirname file))
-                                    (tgt-dir (string-append html "/" dir)))
-                               (install-file file html)))
-                           (find-files "." ".*"))))))
-         ;; Tests can only be run after the library has been installed and not
-         ;; within the source directory.
-         (alist-cons-after
-          'install 'check
-          (lambda _
-            (with-directory-excursion "/tmp"
-              (zero? (system* "python" "-c" "import scipy; scipy.test()"))))
-          (alist-delete
-           'check
-           (alist-cons-after
-            'unpack 'fix-tests
-            (lambda _
-              (substitute* "scipy/integrate/tests/test_quadpack.py"
-                (("libm.so") "libm.so.6"))
-              #t)
-            %standard-phases)))))))
+             (with-directory-excursion "/tmp"
+               (zero? (system* "python" "-c"
+                               "import scipy; scipy.test('full')")))
+             #t)))))
     (home-page "http://www.scipy.org/")
     (synopsis "The Scipy library provides efficient numerical routines")
     (description "The SciPy library is one of the core packages that make up
 the SciPy stack.  It provides many user-friendly and efficient numerical
 routines such as routines for numerical integration and optimization.")
+    (properties `((python2-variant . ,(delay python2-scipy))))
     (license license:bsd-3)))
 
 (define-public python2-scipy
-  (package-with-python2 python-scipy))
+  (package-with-python2
+   (strip-python2-variant python-scipy)))
 
 (define-public python-socksipy-branch
   (package
@@ -4134,11 +4391,22 @@ both of which are installed automatically if you install this library.")
          (base32
           "1wghyvk73cmq3iqyg3fczw128fv2pan2v76m0xg1bw05h8fhvnk3"))))
     (build-system python-build-system)
+    (arguments
+     '(#:tests? #f)) ; FIXME: Many tests require a running database server.
+       ;; #:phases
+       ;; (modify-phases %standard-phases
+       ;;   (replace 'check
+       ;;     (lambda _
+       ;;       (zero? (system* "py.test" "sqlalchemy_utils" "tests")))))
     (propagated-inputs
      `(("python-six" ,python-six)
        ("python-sqlalchemy" ,python-sqlalchemy)))
     (native-inputs
-     `(("python-pytest" ,python-pytest)))
+     `(("python-dateutil" ,python-dateutil)
+       ("python-flexmock" ,python-flexmock)
+       ("python-psycopg2" ,python-psycopg2)
+       ("python-pytest" ,python-pytest)
+       ("python-pytz" ,python-pytz)))
     (home-page "https://github.com/kvesteri/sqlalchemy-utils")
     (synopsis "Various utility functions for SQLAlchemy")
     (description
@@ -4429,16 +4697,18 @@ a front-end for C compilers or analysis tools.")
      `(("python-cffi" ,python-cffi) ; used at run time
        ("python-six" ,python-six)))
     (arguments
-     `(#:phases
-       (alist-cons-after
-        'install 'install-doc
-        (lambda* (#:key outputs #:allow-other-keys)
-          (let ((doc (string-append (assoc-ref outputs "out") "/share"
-                                    "/doc/" ,name "-" ,version)))
-            (mkdir-p doc)
-            (copy-file "README.md"
-                       (string-append doc "/README.md"))))
-        %standard-phases)))
+     `(;; FIXME: Tests cannot load libxcb.so.1
+       #:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'install-doc
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((doc (string-append (assoc-ref outputs "out") "/share"
+                                       "/doc/" ,name "-" ,version)))
+               (mkdir-p doc)
+               (copy-file "README.md"
+                          (string-append doc "/README.md"))
+               #t))))))
     (home-page "https://github.com/tych0/xcffib")
     (synopsis "XCB Python bindings")
     (description
@@ -4475,25 +4745,27 @@ support for Python 3 and PyPy.  It is based on cffi.")
     (propagated-inputs
      `(("python-xcffib" ,python-xcffib))) ; used at run time
     (arguments
-     `(#:phases
-       (alist-cons-after
-        'install 'install-doc
-        (lambda* (#:key inputs outputs #:allow-other-keys)
-          (let* ((data (string-append (assoc-ref outputs "doc") "/share"))
-                 (doc (string-append data "/doc/" ,name "-" ,version))
-                 (html (string-append doc "/html")))
-            (setenv "LD_LIBRARY_PATH"
-                    (string-append (assoc-ref inputs "cairo") "/lib" ":"
-                                   (assoc-ref inputs "gdk-pixbuf") "/lib"))
-            (setenv "LANG" "en_US.UTF-8")
-            (mkdir-p html)
-            (for-each (lambda (file)
-                        (copy-file (string-append "." file)
-                                   (string-append doc file)))
-                      '("/README.rst" "/CHANGES" "/LICENSE"))
-            (system* "python" "setup.py" "build_sphinx")
-            (copy-recursively "docs/_build/html" html)))
-        %standard-phases)))
+     `(;; FIXME: Tests cannot find 'libcairo.so.2'.
+       #:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'install-doc
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((data (string-append (assoc-ref outputs "doc") "/share"))
+                    (doc (string-append data "/doc/" ,name "-" ,version))
+                    (html (string-append doc "/html")))
+               (setenv "LD_LIBRARY_PATH"
+                       (string-append (assoc-ref inputs "cairo") "/lib" ":"
+                                      (assoc-ref inputs "gdk-pixbuf") "/lib"))
+               (setenv "LANG" "en_US.UTF-8")
+               (mkdir-p html)
+               (for-each (lambda (file)
+                           (copy-file (string-append "." file)
+                                      (string-append doc file)))
+                         '("/README.rst" "/CHANGES" "/LICENSE"))
+               (system* "python" "setup.py" "build_sphinx")
+               (copy-recursively "docs/_build/html" html)
+               #t))))))
     (home-page "https://github.com/SimonSapin/cairocffi")
     (synopsis "Python bindings and object-oriented API for Cairo")
     (description
@@ -4574,6 +4846,8 @@ Python language binding specification.")
        (sha256
         (base32 "1gzjg2k6f14i1msm2b0ax8d9ds1hvk6qd5nlaivg8m4cxqp4cp1x"))))
     (build-system python-build-system)
+    (arguments
+     '(#:tests? #f)) ; FIXME: Requires python-cherrypy.
     (propagated-inputs
      `(("python-psutil" ,python-psutil)
        ("python-drmaa" ,python-drmaa)
@@ -4592,21 +4866,39 @@ cluster without needing to write any wrapper code yourself.")
 (define-public python-pexpect
   (package
     (name "python-pexpect")
-    (version "3.3")
+    (version "4.2.1")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append "https://pypi.python.org/packages/source/p/"
-                           "pexpect/pexpect-" version ".tar.gz"))
+       (uri (pypi-uri "pexpect" version))
        (sha256
-        (base32 "1fp5gm976z7ghm8jw57463rj19cv06c8zw842prgyg788f6n3snz"))))
+        (base32 "14ls7k99pwvl21zqv65kzrhccv50j89m5ij1hf0slmsvlxjj84rx"))))
     (build-system python-build-system)
     (arguments
      `(#:phases
        (modify-phases %standard-phases
+         (add-before 'check 'prepare-tests
+           (lambda _
+             (substitute* (find-files "tests")
+               (("/bin/ls") (which "ls"))
+               (("/bin/echo") (which "echo"))
+               (("/bin/which") (which "which"))
+               ;; Many tests try to use the /bin directory which
+               ;; is not present in the build environment.
+               ;; Use one that's non-empty and unlikely to change.
+               (("/bin'") "/dev'"))
+             ;; XXX: Socket connection test gets "Connection reset by peer".
+             ;; Why does it not work? Delete for now.
+             (delete-file "tests/test_socket.py")
+             #t))
          (replace 'check (lambda _ (zero? (system* "nosetests")))))))
     (native-inputs
-     `(("python-nose" ,python-nose)))
+     `(("python-nose" ,python-nose)
+       ("python-pytest" ,python-pytest)
+       ("man-db" ,man-db)
+       ("which" ,which)))
+    (propagated-inputs
+     `(("python-ptyprocess" ,python-ptyprocess)))
     (home-page "http://pexpect.readthedocs.org/")
     (synopsis "Controlling interactive console applications")
     (description
@@ -4622,13 +4914,13 @@ child application and control it as if a human were typing commands.")
 (define-public python-setuptools-scm
   (package
     (name "python-setuptools-scm")
-    (version "1.11.1")
+    (version "1.15.0")
     (source (origin
               (method url-fetch)
               (uri (pypi-uri "setuptools_scm" version))
               (sha256
                (base32
-                "1gqr73i150yzj3mz32854vj93x07yr52kn8fdckwa41ll8wgficc"))))
+                "0bwyc5markib0i7i2qlyhdzxhiywzxbkfiapldma8m91m82jvwfs"))))
     (build-system python-build-system)
     (home-page "https://github.com/pypa/setuptools_scm/")
     (synopsis "Manage Python package versions in SCM metadata")
@@ -4911,20 +5203,26 @@ installing @code{kernelspec}s for use with Jupyter frontends.")
     (build-system python-build-system)
     (arguments
      `(#:tests? #f ; this package does not even have a setup.py
+       #:modules ((guix build python-build-system)
+                  (guix build utils)
+                  (srfi srfi-1))
+       #:imported-modules (,@%python-build-system-modules
+                           (srfi srfi-1))
        #:phases
        (modify-phases %standard-phases
          (delete 'install)
          (replace 'build
-                  (lambda* (#:key inputs outputs #:allow-other-keys)
-                    (let ((dir (string-append
-                                (assoc-ref outputs "out")
-                                "/lib/python"
-                                (string-take (string-take-right
-                                              (assoc-ref inputs "python") 5) 3)
-                                "/site-packages/testpath")))
-                      (mkdir-p dir)
-                      (copy-recursively "testpath" dir))
-                    #t)))))
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((version (last
+                              (string-split (assoc-ref inputs "python") #\-)))
+                    (x.y (string-join (take (string-split version #\.) 2)
+                                        "."))
+                    (dir (string-append
+                          (assoc-ref outputs "out")
+                          "/lib/python" x.y "/site-packages/testpath")))
+               (mkdir-p dir)
+               (copy-recursively "testpath" dir))
+             #t)))))
     (home-page "https://github.com/takluyver/testpath")
     (synopsis "Test utilities for code working with files and commands")
     (description
@@ -4939,17 +5237,18 @@ tools for mocking system commands and recording calls to those.")
 (define-public python-ipython
   (package
     (name "python-ipython")
-    (version "4.0.3")
+    (version "5.2.2")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "ipython" version ".tar.gz"))
        (sha256
-        (base32 "1h2gp1p06sww9rzfkfzqy489bh47gj3910y2b1wdk3dcx1cqz4is"))))
+        (base32 "1qhjwa9cyz1np7rhv3p4ip13lkgbqsad62l24xkwiq1ic2gwiqbf"))))
     (build-system python-build-system)
     (outputs '("out" "doc"))
     (propagated-inputs
      `(("python-pyzmq" ,python-pyzmq)
+       ("python-prompt-toolkit" ,python-prompt-toolkit)
        ("python-terminado" ,python-terminado)
        ("python-matplotlib" ,python-matplotlib)
        ("python-numpy" ,python-numpy)
@@ -4962,16 +5261,19 @@ tools for mocking system commands and recording calls to those.")
        ("python-jsonschema" ,python-jsonschema)
        ("python-traitlets" ,python-traitlets)
        ("python-ipykernel" ,python-ipykernel)
+       ("python-nbformat" ,python-nbformat)
        ("python-pygments" ,python-pygments)))
     (inputs
      `(("readline" ,readline)
        ("which" ,which)))
     (native-inputs
-     `(("pkg-config" ,pkg-config)
+     `(("graphviz" ,graphviz)
+       ("pkg-config" ,pkg-config)
        ("python-requests" ,python-requests) ;; for tests
        ("python-testpath" ,python-testpath)
        ("python-nose" ,python-nose)
        ("python-sphinx" ,python-sphinx)
+       ("python-shpinx-rtd-theme" ,python-sphinx-rtd-theme)
        ("texlive" ,texlive)
        ("texinfo" ,texinfo)))
     (arguments
@@ -4985,15 +5287,16 @@ tools for mocking system commands and recording calls to those.")
                    (html (string-append doc "/html"))
                    (man1 (string-append data "/man/man1"))
                    (info (string-append data "/info"))
-                   (examples (string-append doc "/examples")))
+                   (examples (string-append doc "/examples"))
+                   (python-arg (string-append "PYTHON=" (which "python"))))
               (setenv "LANG" "en_US.utf8")
               ;; Make installed package available for running the tests
               (add-installed-pythonpath inputs outputs)
               (with-directory-excursion "docs"
                 ;; FIXME: pdf fails to build
                 ;;(system* "make" "pdf" "PAPER=a4")
-                (system* "make" "html")
-                (system* "make" "info"))
+                (system* "make" python-arg "html")
+                (system* "make" python-arg "info"))
               (copy-recursively "docs/man" man1)
               (copy-recursively "examples" examples)
               (copy-recursively "docs/build/html" html)
@@ -5043,10 +5346,12 @@ computing.")
   (let ((ipython (package-with-python2 (strip-python2-variant python-ipython))))
     (package
       (inherit ipython)
-      ;; FIXME: some tests are failing
-      (arguments
-       `(#:tests? #f ,@(package-arguments ipython)))
       ;; FIXME: add pyreadline once available.
+      (propagated-inputs
+       `(("python2-backports-shutil-get-terminal-size"
+          ,python2-backports-shutil-get-terminal-size)
+         ("python2-pathlib2" ,python2-pathlib2)
+         ,@(package-propagated-inputs ipython)))
       (native-inputs
        `(("python2-mock" ,python2-mock)
          ,@(package-native-inputs ipython))))))
@@ -5322,13 +5627,12 @@ implementation of D-Bus.")
       `(("sqlite" ,sqlite)))
     (arguments
      `(#:phases
-        ;; swap check and install phases
-        (alist-cons-after
-         'install 'check
-         (assoc-ref %standard-phases 'check)
-         (alist-delete
-          'check
-          %standard-phases))))
+       (modify-phases %standard-phases
+         (delete 'check)
+         (add-after 'install 'check
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (add-installed-pythonpath inputs outputs)
+             (zero? (system* "python" "setup.py" "test")))))))
     (home-page "https://github.com/rogerbinns/apsw/")
     (synopsis "Another Python SQLite Wrapper")
     (description "APSW is a Python wrapper for the SQLite
@@ -5400,7 +5704,8 @@ screen-scraping projects.  It offers Pythonic idioms for navigating,
 searching, and modifying a parse tree, providing a toolkit for
 dissecting a document and extracting what you need.  It automatically
 converts incoming documents to Unicode and outgoing documents to UTF-8.")
-    (license license:expat)))
+    (license license:expat)
+    (properties `((python2-variant . ,(delay python2-beautifulsoup4))))))
 
 (define-public python2-beautifulsoup4
   (package
@@ -5477,6 +5782,7 @@ another XPath engine to find the matching elements in an XML or HTML document.")
         (base32
          "102hy2qisvjxp5s0v9lvwqi4f2dk0dhns40vjgn008yxc7k0h3cr"))))
     (build-system python-build-system)
+    (arguments '(#:tests? #f)) ; No tests.
     (home-page "https://github.com/puiterwijk/python-openid-cla/")
     (synopsis "Implementation of the OpenID CLA extension for python-openid")
     (description "@code{openid-cla} is an implementation of the OpenID
@@ -5498,6 +5804,7 @@ contributor license agreement extension for python-openid.")
         (base32
          "05zrh78alav24rxkbqlpbad6d3x2nljk6z6j7kflxf3vdqa7w969"))))
     (build-system python-build-system)
+    (arguments '(#:tests? #f)) ; No tests.
     (home-page "https://github.com/puiterwijk/python-openid-teams/")
     (synopsis "Implementation of the OpenID teams extension for python-openid")
     (description
@@ -5564,17 +5871,18 @@ of the structure, dynamics, and functions of complex networks.")
 (define-public snakemake
   (package
     (name "snakemake")
-    (version "3.2.1")
+    (version "3.9.0")
     (source
      (origin
        (method url-fetch)
-       (uri (string-append
-             "https://pypi.python.org/packages/source/s/snakemake/snakemake-"
-             version ".tar.gz"))
+       (uri (pypi-uri "snakemake" version))
        (sha256
-        (base32 "0fi4b63sj60hvi7rfydvmz2icl4wj74djw5sn2gl8hxd02qw4b91"))))
+        (base32 "1d48ql0010v9ls6mac7fz6j391gm4h74a64hqgw89s0vfqgdyzdl"))))
     (build-system python-build-system)
-    (home-page "https://bitbucket.org/johanneskoester/snakemake")
+    (arguments
+     ;; TODO: Package missing test dependencies.
+     '(#:tests? #f))
+    (home-page "https://bitbucket.org/snakemake/snakemake/wiki/Home")
     (synopsis "Python-based execution environment for make-like workflows")
     (description
       "Snakemake aims to reduce the complexity of creating workflows by
@@ -5593,6 +5901,8 @@ Python style, together with a fast and comfortable execution environment.")
        (sha256
         (base32 "0pawrqc3mxpwd5g9pvi9gba02637bh5c8ldpp8izfwpfn52469zs"))))
     (build-system python-build-system)
+    (arguments
+     '(#:tests? #f)) ; Tests requires a running X11 server.
     (propagated-inputs
      `(("python-pandas" ,python-pandas)
        ("python-matplotlib" ,python-matplotlib)
@@ -5614,10 +5924,40 @@ and statistical routines from scipy and statsmodels.")
       (propagated-inputs `(("python2-pytz" ,python2-pytz)
                            ,@(package-propagated-inputs base))))))
 
+(define-public python-mpmath
+  (package
+  (name "python-mpmath")
+  (version "0.19")
+  (source (origin
+            (method url-fetch)
+            (uri (string-append "http://mpmath.org/files/mpmath-"
+                                version ".tar.gz"))
+            (sha256
+             (base32
+              "08ijsr4ifrqv3cjc26mkw0dbvyygsa99in376hr4b96ddm1gdpb8"))))
+  (build-system python-build-system)
+  (arguments
+   '(#:phases
+     (modify-phases %standard-phases
+       (replace 'check
+         (lambda _
+           (zero?
+            (system* "python" "mpmath/tests/runtests.py" "-local")))))))
+  (home-page "http://mpmath.org")
+  (synopsis "Arbitrary-precision floating-point arithmetic in python")
+  (description
+    "@code{mpmath} can be used as an arbitrary-precision substitute for
+Python's float/complex types and math/cmath modules, but also does much
+more advanced mathematics.")
+  (license license:bsd-3)))
+
+(define-public python2-mpmath
+  (package-with-python2 python-mpmath))
+
 (define-public python-sympy
   (package
     (name "python-sympy")
-    (version "0.7.6")
+    (version "1.0")
     (source
      (origin
        (method url-fetch)
@@ -5625,8 +5965,10 @@ and statistical routines from scipy and statsmodels.")
              "https://github.com/sympy/sympy/releases/download/sympy-"
              version "/sympy-" version ".tar.gz"))
        (sha256
-        (base32 "19yp0gy4i7p4g6l3b8vaqkj9qj7yqb5kqy0qgbdagpzgkdz958yz"))))
+        (base32 "1bpzjwr9hrr7w88v4vgnj9lr6vxcldc94si13n8xpr1rv08d5b1y"))))
     (build-system python-build-system)
+    (propagated-inputs
+     `(("python-mpmath" ,python-mpmath)))
     (home-page "http://www.sympy.org/")
     (synopsis "Python library for symbolic mathematics")
     (description
@@ -5744,6 +6086,17 @@ It is written entirely in Python.")
        (sha256
         (base32 "1gzgwayl6hmc9jfcl88bni4jcsk2jcca9dn1rvrfsvnijcjx7hn9"))))
     (build-system python-build-system)
+    (arguments
+     '(;; FIXME: Two tests error out with:
+       ;; AssertionError: b'Error in atexit._run_exitfuncs:\nFileNotF[44 chars]ry\n' != b''
+       ;; #:phases
+       ;; (modify-phases %standard-phases
+       ;;   (replace 'check
+       ;;     (lambda _
+       ;;       ;; 'setup.py test' hits an AssertionError on BSD-specific
+       ;;       ;; "tornado/platform/kqueue.py". This is the supported method:
+       ;;       (zero? (system* "python" "-m" "tornado.test")))))
+       #:tests? #f))
     (native-inputs
      `(("python-certifi" ,python-certifi)))
     (propagated-inputs
@@ -5791,6 +6144,36 @@ connection to each user.")
 (define-public python2-backports-abc
   (package-with-python2 python-backports-abc))
 
+(define-public python2-backports-shutil-get-terminal-size
+  (package
+    (name "python2-backports-shutil-get-terminal-size")
+    (version "1.0.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "backports.shutil_get_terminal_size" version))
+       (sha256
+        (base32
+         "107cmn7g3jnbkp826zlj8rrj19fam301qvaqf0f3905f5217lgki"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:python ,python-2
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _
+             (zero? (system* "py.test" "-v")))))))
+    (native-inputs
+     `(("python2-pytest" ,python2-pytest)))
+    (home-page "https://github.com/chrippa/backports.shutil_get_terminal_size")
+    (synopsis "Backport of Python 3.3's @code{shutil.get_terminal_size}")
+    (description
+     "This package provides a backport of the @code{get_terminal_size
+function} from Python 3.3's @code{shutil}.
+Unlike the original version it is written in pure Python rather than C,
+so it might be a tiny bit slower.")
+    (license license:expat)))
+
 (define-public python-waf
   (package
     (name "python-waf")
@@ -5953,7 +6336,10 @@ complexity of Python source code.")
                ".tar.gz"))
         (sha256
           (base32
-            "12b9bbdbwnspxgak14xg58c130x2n0blxzlms5jn2dszn8qj3d0m"))))))
+           "12b9bbdbwnspxgak14xg58c130x2n0blxzlms5jn2dszn8qj3d0m"))))
+    (arguments
+     ;; XXX Tests not compatible with Python 3.5.
+     '(#:tests? #f))))
 
 (define-public python2-pep8-1.5.7
   (package-with-python2 python-pep8-1.5.7))
@@ -5972,7 +6358,10 @@ complexity of Python source code.")
                ".tar.gz"))
         (sha256
           (base32
-            "0sbpq6pqm1i9wqi41mlfrsc5rk92jv4mskvlyxmnhlbdnc80ma1z"))))))
+           "0sbpq6pqm1i9wqi41mlfrsc5rk92jv4mskvlyxmnhlbdnc80ma1z"))))
+    (arguments
+     ;; XXX Tests not compatible with Python 3.5.
+     '(#:tests? #f))))
 
 (define-public python2-pyflakes-0.8.1
   (package-with-python2 python-pyflakes-0.8.1))
@@ -6040,7 +6429,10 @@ complexity of Python source code.")
             (for-each delete-file-recursively
                       (find-files "." "__pycache__" #:directories? #t))
             (for-each delete-file (find-files "." "\\.pyc$"))
-            #t))))))
+            #t))))
+    (arguments
+     ;; XXX Fails with Python 3.5.
+     '(#:tests? #f))))
 
 (define-public python2-flake8-2.2.4
   (package-with-python2 python-flake8-2.2.4))
@@ -6057,6 +6449,20 @@ complexity of Python source code.")
         (base32
          "02gn2wxvh9vnf7m7dld7ca4l60mg5c370hv3swwppkngwaqmcw67"))))
     (build-system python-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _
+             (setenv "PYTHONPATH"
+                     (string-append (getcwd) "/build/lib:"
+                                    (getenv "PYTHONPATH")))
+             (zero? (system* "py.test" "-v")))))))
+    (native-inputs
+     `(("python-flake8" ,python-flake8)
+       ("python-mock" ,python-mock)
+       ("python-pycodestyle" ,python-pycodestyle)
+       ("python-pytest" ,python-pytest)))
     (home-page "https://gitlab.com/pycqa/flake8-polyfill")
     (synopsis "Polyfill package for Flake8 plugins")
     (description
@@ -6329,6 +6735,9 @@ from an XML-based format.")
         (base32
          "0g6n288l83sfwavxh1aryi0aqvsr3sp7v6f903mckwqa4scpky62"))))
     (build-system python-build-system)
+    (arguments
+     ;; FIXME: Some tests need network access.
+     '(#:tests? #f))
     (synopsis "Tool and library for manipulating LilyPond files")
     (description "This package provides a Python library to parse, manipulate
 or create documents in LilyPond format.  A command line program ly is also
@@ -6497,6 +6906,8 @@ and MAC network addresses.")
        (base32
         "0c7gh3lsdjds262h0v1sqc66l7hqgfwbakn96qrhdbl0i3vm5yz8"))))
   (build-system python-build-system)
+  (native-inputs
+   `(("python-pytest" ,python-pytest)))
   (home-page "https://bitbucket.org/micktwomey/pyiso8601")
   (synopsis "Module to parse ISO 8601 dates")
   (description
@@ -6909,13 +7320,25 @@ message digests and key derivation functions.")
        (uri (pypi-uri "pyOpenSSL" version))
        (sha256
         (base32
-         "0vji4yrfshs15xpczbhzhasnjrwcarsqg87n98ixnyafnyxs6ybp"))))
+         "0vji4yrfshs15xpczbhzhasnjrwcarsqg87n98ixnyafnyxs6ybp"))
+       (patches
+        (search-patches "python-pyopenssl-skip-network-test.patch"))))
     (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)
+             (zero? (system* "py.test" "-v")))))))
     (propagated-inputs
      `(("python-cryptography" ,python-cryptography)
        ("python-six" ,python-six)))
     (inputs
      `(("openssl" ,openssl)))
+    (native-inputs
+     `(("python-pytest" ,python-pytest)))
     (home-page "https://github.com/pyca/pyopenssl")
     (synopsis "Python wrapper module around the OpenSSL library")
     (description
@@ -7230,9 +7653,19 @@ functions to find and load entry points.")
         (base32
          "0brclbb18l4nmd5qy3dl9wn05rjdh1fz4rmzdlfqacj12rcdvdgp"))))
     (build-system python-build-system)
-    ;; The "bdist_egg" target is disabled by default, causing the installation
-    ;; to fail.
-    (arguments `(#:configure-flags (list "bdist_egg")))
+    (arguments
+     `(;; The "bdist_egg" target is disabled by default, causing the installation
+       ;; to fail.
+       #:configure-flags (list "bdist_egg")
+       ;; FIXME: 5 failures, 40 errors.
+       #:tests? #f))
+       ;; #:phases
+       ;; (modify-phases %standard-phases
+       ;;   (replace 'check
+       ;;     (lambda _
+       ;;       (zero? (system* "py.test" "-v")))))
+    (native-inputs
+     `(("python-pytest" ,python-pytest)))
     (propagated-inputs
      `(("python-bleach" ,python-bleach)
        ("python-entrypoints" ,python-entrypoints)
@@ -7333,7 +7766,8 @@ interactive computing.")
     (propagated-inputs
      `(("python-notebook" ,python-notebook)))
     (native-inputs
-     `(("python-nose" ,python-nose)))
+     `(("python-certifi" ,python-certifi)
+       ("python-nose" ,python-nose)))
     (home-page "http://ipython.org")
     (synopsis "IPython HTML widgets for Jupyter")
     (description "This package provides interactive HTML widgets for Jupyter
@@ -7614,6 +8048,8 @@ forms, HTTP servers, regular expressions, and more.")
         (base32
          "1r7iqknhh55y45f64mz5hghgvzx34h1i11k350s0avx6q8gznja1"))))
     (build-system python-build-system)
+    (arguments
+     '(#:tests? #f)) ; FIXME: Tests can't find zope.interface.
     (native-inputs
      `(("python-six" ,python-six)
        ;("python-zope-interface" ,python-zope-interface)
@@ -7674,8 +8110,11 @@ internationalized messages within program source text.")
         (base32
          "1p943jdxb587dh7php4vx04qvn7b2877hr4qs5zyckvp5afhhank"))))
     (build-system python-build-system)
+    (arguments
+     '(#:tests? #f)) ; FIXME: Tests can't find zope.event.
     (propagated-inputs
      `(("python-zope-event" ,python-zope-event)
+       ("python-zope-exceptions", python-zope-exceptions)
        ("python-zope-interface" ,python-zope-interface)))
     (native-inputs
      `(("python-zope-testing" ,python-zope-testing)
@@ -7703,6 +8142,8 @@ defining data schemas.")
                (base32
                 "1x9dfqypgympnlm25p9m43xh4qv3p7d75vksv9pzqibrb4cggw5n"))))
     (build-system python-build-system)
+    (arguments
+     '(#:tests? #f)) ; FIXME: Tests can't find zope.interface.
     (propagated-inputs
      `(("python-zope-i18nmessageid" ,python-zope-i18nmessageid)
        ("python-zope-schema" ,python-zope-schema)))
@@ -7728,6 +8169,8 @@ Markup Language.")
         (base32
          "0pqwwmvm1prhwv1ziv9lp8iirz7xkwb6n2kyj36p2h0ppyyhjnm4"))))
     (build-system python-build-system)
+    (arguments
+     '(#:tests? #f)) ; FIXME: Tests can't find zope.interface.
     (propagated-inputs
      `(("python-zope-interface" ,python-zope-interface)))
     (home-page "http://pypi.python.org/pypi/zope.proxy")
@@ -7755,6 +8198,8 @@ brokering, etc.) for which the proxy is responsible.")
         (base32
          "1nj9da4ksiyv3h8n2vpzwd0pb03mdsh7zy87hfpx72b6p2zcwg74"))))
     (build-system python-build-system)
+    (arguments
+     '(#:tests? #f)) ; FIXME: Tests can't find zope.interface.
     (propagated-inputs
      `(("python-zope-proxy" ,python-zope-proxy)
        ("python-zope-schema" ,python-zope-schema)))
@@ -7780,12 +8225,15 @@ Zope3, which are are special objects that have a structural location.")
         (base32
          "14zmf684amc0x32kq05yxnhfqd1cmyhafkw05gn81rn90zjv6ssy"))))
     (build-system python-build-system)
+    (arguments
+     '(#:tests? #f)) ; FIXME: Tests can't find zope.testrunner.
     (propagated-inputs
      `(("python-zope-i18nmessageid" ,python-zope-i18nmessageid)
        ("python-zope-proxy" ,python-zope-proxy)
        ("python-zope-schema" ,python-zope-schema)))
-     (native-inputs
-     `(("python-zope-component" ,python-zope-component)
+    (native-inputs
+     `(("python-six" ,python-six)
+       ("python-zope-component" ,python-zope-component)
        ("python-zope-configuration" ,python-zope-configuration)
        ("python-zope-location" ,python-zope-location)
        ("python-zope-testrunner" ,python-zope-testrunner)
@@ -8259,6 +8707,8 @@ minimal and fast API targetting the following uses:
          (base32
           "0k3vypszmgmaipgw9xscvgm79h2zd6p6ci8gdp5sxl6g5kbqr9fy"))))
     (build-system python-build-system)
+    ;; TODO: Tests require packaging 'hiredis'.
+    (arguments '(#:tests? #f))
     (home-page "https://github.com/benjolitz/trollius-redis")
     (synopsis "Port of asyncio-redis to trollius")
     (description "@code{trollius-redis} is a Redis client for Python
@@ -8389,7 +8839,7 @@ processes across test runs.")
                "086jslw8cg2hni79j267p1dy6d27m7q5hi39ni2clh9waqbdf5v3"))))
     (build-system python-build-system)
     (propagated-inputs
-     `(("python-dateutil-2" ,python-dateutil-2)
+     `(("python-dateutil" ,python-dateutil)
        ("python-pytz" ,python-pytz)))
     (synopsis "Python library for parsing iCalendar files")
     (description "The icalendar package is a parser/generator of iCalendar
@@ -8407,6 +8857,7 @@ files for use with Python.")
              (sha256
               (base32
                "1d7gam3mn8v4in4p16yn3v10vps7nnaz6ilw99j4klij39dqd37p"))))
+    (arguments '(#:tests? #f)) ; No tests.
     (build-system python-build-system)
     (propagated-inputs
      `(("python-sphinx" ,python-sphinx)))
@@ -8447,6 +8898,14 @@ Blog, News or Announcements section to a Sphinx website.")
                (base32
                 "1an5lkkqk1zha47198p42ji3m94xmzx1a03dn7866m87n4r4q8h5"))))
     (build-system python-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _
+             (zero? (system* "py.test" "-v")))))))
+    (native-inputs
+     `(("python-pytest" ,python-pytest)))
     (propagated-inputs
      `(("python-args" ,python-args)))
     (home-page "https://github.com/kennethreitz/clint")
@@ -8516,6 +8975,17 @@ with a new public API, and RPython support.")
                (base32
                 "1msqv747iz12r73mz4qvsmlwkddwjvrahlrk7ysrcz07h7dsscxs"))))
     (build-system python-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _
+             ;; Tests require write access to HOME.
+             (setenv "HOME" "/tmp")
+             (zero? (system* "nosetests")))))))
+    (native-inputs
+     `(("python-coverage" ,python-coverage)
+       ("python-nose" ,python-nose)))
     (propagated-inputs
      `(("python-astor" ,python-astor)
        ("python-clint" ,python-clint)
@@ -8586,6 +9056,47 @@ authenticated session objects providing things like keep-alive.")
 3.2.3 for use with older versions of Python and PyPy.")
     (license license:expat)))
 
+(define-public python2-subprocess32
+  (package
+    (name "python2-subprocess32")
+    (version "3.2.7")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "subprocess32" version))
+              (sha256
+               (base32
+                "14350dhhlhyz5gqzi3lihn9m6lvskx5mcb20srx1kgsk9i50li8y"))
+              (patches
+               (search-patches "python2-subprocess32-disable-input-test.patch"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:python ,python-2
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-/bin/sh
+           (lambda _
+             (substitute* '("subprocess32.py"
+                            "test_subprocess32.py")
+               (("/bin/sh") (which "sh")))
+             #t))
+         (delete 'check)
+         (add-after 'install 'check
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             ;; For some reason this package fails to import
+             ;; _posixsubprocess.so when PYTHONPATH is set to the build
+             ;; directory. Running tests after install is easier.
+             (add-installed-pythonpath inputs outputs)
+             (zero? (system* "python" "test_subprocess32.py")))))))
+    (home-page "https://github.com/google/python-subprocess32")
+    (synopsis "Backport of the subprocess module from Python 3.2")
+    (description
+     "This is a backport of the @code{subprocess} standard library module
+from Python 3.2 and 3.3 for use on Python 2.  It includes bugfixes and some
+new features.  On POSIX systems it is guaranteed to be reliable when used
+in threaded applications.  It includes timeout support from Python 3.3 but
+otherwise matches 3.2’s API.")
+    (license license:psfl)))
+
 (define-public python2-futures
   (package
     (name "python2-futures")
@@ -8790,6 +9301,8 @@ servers.")
       (base32
        "0g9xvl69y7nr3w7ag4fsp6sm4fqf6vrqjw7504x2hzrrsh3ampq8"))))
    (build-system python-build-system)
+   (native-inputs
+    `(("python-nose" ,python-nose)))
    (synopsis "JSON Matching Expressions")
    (description "JMESPath (pronounced “james path”) is a Python library that
 allows one to declaratively specify how to extract elements from a JSON
@@ -8812,8 +9325,11 @@ document.")
       (base32
        "1hqvqwhgfcch4knm1l02ynx7qd1igxk3pj34c1x2b0r79jca524n"))))
    (build-system python-build-system)
+   (arguments
+    ;; FIXME: Many tests are failing.
+    '(#:tests? #f))
    (propagated-inputs
-    `(("python-dateutil" ,python-dateutil-2)
+    `(("python-dateutil" ,python-dateutil)
       ("python-docutils" ,python-docutils)
       ("python-jmespath" ,python-jmespath)))
    (native-inputs
@@ -8849,12 +9365,9 @@ interface to the Amazon Web Services (AWS) API.")
       ("python-s3transfer" ,python-s3transfer)
       ("python-docutils" ,python-docutils)
       ("python-rsa" ,python-rsa)))
-   (native-inputs
-    `(("python-mock" ,python-mock)
-      ("python-nose" ,python-nose)
-      ("python-sphinx" ,python-sphinx)
-      ("python-tox" ,python-tox)
-      ("python-wheel" ,python-wheel)))
+   (arguments
+    ;; FIXME: The 'pypi' release does not contain tests.
+    '(#:tests? #f))
    (home-page "https://aws.amazon.com/cli/")
    (synopsis "Command line client for AWS")
    (description "AWS CLI provides a unified command line interface to the
@@ -8872,7 +9385,7 @@ Amazon Web Services (AWS) API.")
                (base32
                 "0qyqq9akm4vshhn8cngjc1qykcvsn7cz6dlm6njfsgpbraqrmbbw"))))
     (build-system python-build-system)
-    (propagated-inputs
+    (native-inputs
      `(("python-flake8" ,python-flake8)
        ("python-pytest" ,python-pytest)))
     (synopsis "Library for property based testing")
@@ -8889,7 +9402,8 @@ seamlessly into your existing Python unit testing work flow.")
                      (strip-python2-variant python-hypothesis))))
     (package (inherit hypothesis)
       (native-inputs
-       `(("python2-enum34" ,python2-enum34))))))
+       `(("python2-enum34" ,python2-enum34)
+         ,@(package-native-inputs hypothesis))))))
 
 (define-public python-pytest-subtesthack
   (package
@@ -9011,7 +9525,8 @@ available in Django, but is a standalone package.")
      `(("python-markupsafe" ,python-markupsafe)))
     (native-inputs
      `(("python-mock" ,python-mock)
-       ("python-nose" ,python-nose)))
+       ("python-nose" ,python-nose)
+       ("python-pytest" ,python-pytest)))
     (home-page "http://www.makotemplates.org/")
     (synopsis "Templating language for Python")
     (description "Mako is a templating language for Python that compiles
@@ -9355,6 +9870,10 @@ RabbitMQ messaging server is the most popular implementation.")
                 (strip-python2-variant python-kombu))))
     (package
       (inherit kombu)
+      (arguments `(;; FIXME: 'TestTransport.test_del_sync' fails on python2.
+                   ;; It works fine on the python3 variant.
+                   #:tests? #f
+                   ,@(package-arguments kombu)))
       (native-inputs `(("python2-unittest2" ,python2-unittest2)
                 ,@(package-native-inputs kombu))))))
 
@@ -9501,6 +10020,9 @@ programmatically interfacing with your system's $EDITOR.")
                (base32
                 "098as6z1s0gb4dh5xcr1fd2vpm91zj93jzvgawspxf5s4hqs0xhp"))))
     (build-system python-build-system)
+    (arguments
+     ;; FIXME: Many tests are failing and the upstream is gone.
+     '(#:tests? #f))
     (propagated-inputs
      `(("python-sphinx" ,python-sphinx)))
     (synopsis "Sphinx extension to include program output")
@@ -9523,6 +10045,7 @@ commands into documents, helping you to keep your command examples up to date.")
                (base32
                 "08ycivzf7bh4a1zcyp31hbyqs1b2c9r26raa3vxjwwmbfqr3iw4f"))))
     (build-system python-build-system)
+    (arguments '(#:tests? #f)) ; No tests.
     (propagated-inputs
      `(("python-sphinx" ,python-sphinx)
        ("python-zope-interface" ,python-zope-interface)))
@@ -9578,7 +10101,7 @@ introspection of @code{zope.interface} instances in code.")
      '(;; The test suite relies on some non-portable Windows interfaces.
        #:tests? #f))
     (propagated-inputs
-     `(("python-dateutil-2" ,python-dateutil-2)
+     `(("python-dateutil" ,python-dateutil)
        ("python-pyicu" ,python-pyicu)))
     (synopsis "Parse and generate vCard and vCalendar files")
     (description "Vobject is intended to be a full featured Python package for
@@ -9653,6 +10176,16 @@ presume or force a developer to use a particular tool or library.")
         (base32
          "04l5743j2dici46038sqlzvf0xzpg8rf7s9ld2x24xv7f4idg990"))))
     (build-system python-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'drop-failing-test
+           (lambda _
+             ;; FIXME: This file tries resolving an external server, which
+             ;; fails. Try to patch out the offending section instead of
+             ;; deleting the whole thing.
+             (delete-file "tests/test_recaptcha.py")
+             #t)))))
     (propagated-inputs
      `(("python-flask-babel" ,python-flask-babel)
        ("python-babel" ,python-babel)
@@ -10264,6 +10797,8 @@ to occurences in strings and comments.")
         (base32
          "0i283z1pivmir61z8kbiycigc94l61v33ygzkhczf1ifq7cppyds"))))
     (build-system python-build-system)
+    (arguments
+     '(#:tests? #f)) ; TODO: Requires many libraries not in Guix.
     (home-page "https://github.com/ultrabug/py3status")
     (synopsis "Extensible i3status wrapper written in Python")
     (description "py3status is an i3status wrapper which extends i3status
@@ -10407,6 +10942,72 @@ to provide a high-level synchronous API on top of the libev event loop.")
 (define-public python2-gevent
   (package-with-python2 python-gevent))
 
+(define-public python-geventhttpclient
+  (package
+    (name "python-geventhttpclient")
+    (version "1.3.1")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "geventhttpclient" version))
+              (sha256
+               (base32
+                "07d0q3wzmml75227r6y6mrl5a0zpf4v9gj0ni5rhbyzmaj4az1xx"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  ;; Delete pre-compiled files.
+                  (for-each delete-file (find-files "src/geventhttpclient"
+                                                    ".*\\.pyc"))
+                  #t))))
+    (build-system python-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'delete-network-tests
+           (lambda _
+             (delete-file "src/geventhttpclient/tests/test_client.py")
+             #t))
+         (delete 'check)
+         (add-after 'install 'check
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (add-installed-pythonpath inputs outputs)
+             (zero? (system* "py.test" "src/geventhttpclient/tests" "-v")))))))
+    (native-inputs
+     `(("python-pytest" ,python-pytest)))
+    (propagated-inputs
+     `(("python-certifi" ,python-certifi)
+       ("python-gevent" ,python-gevent)
+       ("python-six" ,python-six)))
+    (home-page "https://github.com/gwik/geventhttpclient")
+    (synopsis "HTTP client library for gevent")
+    (description "@code{python-geventhttpclient} is a high performance,
+concurrent HTTP client library for python using @code{gevent}.")
+    (license license:expat)))
+
+(define-public python2-geventhttpclient
+  (package-with-python2 python-geventhttpclient))
+
+(define-public python-fastimport
+  (package
+    (name "python-fastimport")
+    (version "0.9.6")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (pypi-uri "fastimport" version))
+        (sha256
+          (base32 "1aqjsin4rmqm7ln4j0p73fzxifws6c6ikgyhav7r137m2ixsxl43"))))
+    (build-system python-build-system)
+    (home-page "https://github.com/jelmer/python-fastimport")
+    (synopsis "VCS fastimport parser and generator in Python")
+    (description "This package provides a parser for and generator of the Git
+@url{https://www.kernel.org/pub/software/scm/git/docs/git-fast-import.html,fastimport}
+format.")
+    (license license:gpl2+)))
+
+(define-public python2-fastimport
+  (package-with-python2 python-fastimport))
+
 (define-public python-twisted
   (package
     (name "python-twisted")
@@ -10418,6 +11019,13 @@ to provide a high-level synchronous API on top of the libev event loop.")
                (base32
                 "0ydxrp9myw1mvsz3qfzx5579y5llmqa82pxvqchgp5syczffi450"))))
     (build-system python-build-system)
+    (arguments
+     '(#:tests? #f)) ; FIXME: Some tests are failing.
+       ;; #:phases
+       ;; (modify-phases %standard-phases
+       ;;   (replace 'check
+       ;;     (lambda _
+       ;;       (zero? (system* "./bin/trial" "twisted")))))
     (propagated-inputs
      `(("python-zope-interface" ,python-zope-interface)))
     (home-page "https://twistedmatrix.com/")
@@ -10487,18 +11095,12 @@ It uses LR parsing and does extensive error checking.")
              (uri (pypi-uri "tabulate" version))
              (sha256
               (base32
-               "1inqhspd4frxnp08c32yndr0lc4px1xfkqah184i5w09gkhvi843"))
-             ;; Fix tests
-             (modules '((guix build utils)))
-             (snippet '(substitute* '("test/test_cli.py"
-                                      "test/test_input.py"
-                                      "test/test_output.py"
-                                      "test/test_regression.py")
-                         (("from common") "from nose.tools")))))
+               "1inqhspd4frxnp08c32yndr0lc4px1xfkqah184i5w09gkhvi843"))))
     (build-system python-build-system)
-    (native-inputs
-     `(;; For testing
-       ("python-nose" ,python-nose)))
+    (arguments
+     ;; FIXME: The pypi release tarball is missing a 'test/common.py'
+     ;; and the latest release is not tagged in the upstream repository.
+     '(#:tests? #f))
     (home-page "https://bitbucket.org/astanin/python-tabulate")
     (synopsis "Pretty-print tabular data")
     (description
@@ -10656,7 +11258,7 @@ objects, patterned after the Mocha library for Ruby.")
        ("python-chai" ,python-chai)
        ("python-simplejson" ,python-simplejson)))
     (propagated-inputs
-     `(("python-dateutil" ,python-dateutil-2)))
+     `(("python-dateutil" ,python-dateutil)))
     (home-page "https://github.com/crsmithdev/arrow/")
     (synopsis "Dates and times for Python")
     (description
@@ -10679,6 +11281,8 @@ datetime type.")
               (base32
                "1jhnxgnw8y3mbzjssixh6qkc7a3afc4fygajhqrqalnilyvpzshq"))))
     (build-system python-build-system)
+    (native-inputs
+     `(("python-pytest" ,python-pytest)))
     (home-page "http://github.com/jpvanhal/inflection")
     (synopsis "Python string transformation library")
     (description
@@ -10836,6 +11440,55 @@ parsing UK postcodes.")
 (define-public python2-ukpostcodeparser
   (package-with-python2 python-ukpostcodeparser))
 
+(define-public python-faker
+  (package
+  (name "python-faker")
+  (version "0.7.9")
+  (source (origin
+            (method url-fetch)
+            (uri (pypi-uri "Faker" version))
+            (sha256
+             (base32
+              "1fh2p2yz0fsdr4fqwxgddwbvfb6qn6vp8yx0qwqzra27yq5d1wsm"))
+            (patches
+             (search-patches "python-faker-fix-build-32bit.patch"))
+            (modules '((guix build utils)))
+            (snippet
+             '(begin
+                (for-each delete-file (find-files "." "\\.pyc$"))
+                #t))))
+  (build-system python-build-system)
+  (arguments
+   '(#:phases
+     (modify-phases %standard-phases
+       (replace 'check
+         (lambda _
+           (zero? (system* "python" "-m" "unittest" "-v" "tests")))))))
+  (native-inputs
+   `(;; For testing
+     ("python-email-validator" ,python-email-validator)
+     ("python-mock" ,python-mock)
+     ("python-ukpostcodeparser" ,python-ukpostcodeparser)))
+  (propagated-inputs
+   `(("python-dateutil" ,python-dateutil)
+     ("python-six" ,python-six)))
+  (home-page "https://github.com/joke2k/faker")
+  (synopsis "Python package that generates fake data")
+  (description
+   "Faker is a Python package that generates fake data such as names,
+addresses, and phone numbers.")
+  (license license:expat)
+  (properties `((python2-variant . ,(delay python2-faker))))))
+
+(define-public python2-faker
+  (let ((base (package-with-python2 (strip-python2-variant
+                                     python-faker))))
+    (package
+      (inherit base)
+      (propagated-inputs
+       `(("python2-ipaddress" ,python2-ipaddress)
+         ,@(package-propagated-inputs base))))))
+
 (define-public python-fake-factory
   (package
   (name "python-fake-factory")
@@ -10845,15 +11498,24 @@ parsing UK postcodes.")
             (uri (pypi-uri "fake-factory" version))
             (sha256
              (base32
-              "0vs0dkmg0dlaxf8w6q2i3k0i03gmp56ablldv7ci9x3nbadkn71g"))))
+              "0vs0dkmg0dlaxf8w6q2i3k0i03gmp56ablldv7ci9x3nbadkn71g"))
+            (patches
+             (search-patches
+              "python-fake-factory-fix-build-32bit.patch"))))
   (build-system python-build-system)
+  (arguments
+   '(#:phases
+     (modify-phases %standard-phases
+       (replace 'check
+         (lambda _
+           (zero? (system* "python" "-m" "unittest" "-v" "faker.tests")))))))
   (native-inputs
    `(;; For testing
      ("python-email-validator" ,python-email-validator)
      ("python-mock" ,python-mock)
      ("python-ukpostcodeparser" ,python-ukpostcodeparser)))
   (propagated-inputs
-   `(("python-dateutil" ,python-dateutil-2)
+   `(("python-dateutil" ,python-dateutil)
      ("python-six" ,python-six)))
   (home-page "https://github.com/joke2k/faker")
   (synopsis "Python package that generates fake data")
@@ -10861,13 +11523,15 @@ parsing UK postcodes.")
    "Faker is a Python package that generates fake data such as names,
 addresses, and phone numbers.")
   (license license:expat)
-  (properties `((python2-variant . ,(delay python2-fake-factory))))))
+  (properties `((python2-variant . ,(delay python2-fake-factory))
+                (superseded . ,python-faker)))))
 
 (define-public python2-fake-factory
   (let ((base (package-with-python2 (strip-python2-variant
                                      python-fake-factory))))
     (package
       (inherit base)
+      (properties `((superseded . ,python2-faker)))
       (propagated-inputs
        `(("python2-ipaddress" ,python2-ipaddress)
          ,@(package-propagated-inputs base))))))
@@ -10883,6 +11547,8 @@ addresses, and phone numbers.")
                (base32
                 "1f5m28vkh4ksq3d80d8mmd2z8wxvc3mgy2pmrv2751dm2xgznm4w"))))
     (build-system python-build-system)
+    (native-inputs
+     `(("python-unidecode" ,python-unidecode)))
     (propagated-inputs
      `(("python-pyyaml" ,python-pyyaml)))
     (home-page "https://github.com/mk-fg/pretty-yaml")
@@ -10932,7 +11598,7 @@ mocks, stubs and fakes.")
      `(("python-arrow" ,python-arrow)
        ("python-blinker" ,python-blinker)
        ("python-cleo" ,python-cleo)
-       ("python-fake-factory" ,python-fake-factory)
+       ("python-faker" ,python-faker)
        ("python-inflection" ,python-inflection)
        ("python-lazy-object-proxy" ,python-lazy-object-proxy)
        ("python-pyaml" ,python-pyaml)
@@ -10997,6 +11663,11 @@ characters, mouse support, and auto suggestions.")
           (base32
             "0c8x962ynpx001fdvp07m2q5jk4igkxbj3rmnydavphvlgxijk1v"))))
     (build-system python-build-system)
+    (arguments
+     ;; FIXME: One test fails (use "py.test" instead of 'setup.py test').
+     '(#:tests? #f))
+    (native-inputs
+     `(("python-pytest" ,python-pytest)))
     (home-page "https://github.com/davidhalter/jedi")
     (synopsis
       "Autocompletion for Python that can be used for text editors")
@@ -11018,6 +11689,8 @@ characters, mouse support, and auto suggestions.")
                (base32
                 "1mmbiyzf0n8hm7z2a562x7w5cbl6jc0zsk6vp40q1z4cyblv1k13"))))
     (build-system python-build-system)
+    (arguments
+     '(#:tests? #f)) ; FIXME: No tests in pypi tarball.
     (propagated-inputs
      `(("python-docopt" ,python-docopt)
        ("python-jedi" ,python-jedi)
@@ -11123,6 +11796,13 @@ relays publish about themselves.")
           (base32
             "0k1nfdrxxkdlv4zgaqsdv8li0pj3gbh2pyxw8q2bsg6f9490amyn"))))
     (build-system python-build-system)
+    (arguments
+     '(#:tests? #f)) ; FIXME: 3/49 tests are failing.
+       ;; #:phases
+       ;; (modify-phases %standard-phases
+       ;;   (replace 'check
+       ;;     (lambda _
+       ;;       (zero? (system* "python" "test/run_all_tests.py" "loop://")))))))
     (home-page
       "https://github.com/pyserial/pyserial")
     (synopsis "Python Serial Port Bindings")
@@ -11442,7 +12122,7 @@ List.  Forked from and using the same API as the publicsuffix package.")
        ("python-coverage" ,python-coverage)))
     (propagated-inputs
      `(("python-six" ,python-six)
-       ("python-dateutil-2" ,python-dateutil-2)))
+       ("python-dateutil" ,python-dateutil)))
     (arguments
      `(#:phases (modify-phases %standard-phases
         ;; The tests are normally executed via `make test`, but the PyPi
@@ -11879,6 +12559,8 @@ English stemmer.")
                (base32
                 "0zm9ap4p5dzln8f1m2immadaxv2xpg8jg4w53y52rhfl7pdb58vy"))))
     (build-system python-build-system)
+    ;; FIXME: The 'pypi' release archive does not contain tests.
+    (arguments '(#:tests? #f))
     (native-inputs
      `(("python-sphinx" ,python-sphinx)))
     (home-page "https://bitbucket.org/ecollins/cloud_sptheme")
@@ -12093,7 +12775,7 @@ useful as a validator for JSON data.")
             "1k5mjg9iqbjfslb5prrsfz7dhlvi6s35p1jxq8dm87w1b7dn5i2g"))))
     (build-system python-build-system)
     (propagated-inputs
-     `(("python-dateutil-2" ,python-dateutil-2)))
+     `(("python-dateutil" ,python-dateutil)))
     (home-page
       "https://bitbucket.org/nielsenb/aniso8601")
     (synopsis
@@ -12290,10 +12972,7 @@ python-axolotl.")
            (lambda _
              (for-each delete-file-recursively
                        '("axolotl/tests" "build/lib/axolotl/tests"))
-             #t)))
-       ;; Prevent creation of the egg. This works around
-       ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20765
-       #:configure-flags '("--root=/")))
+             #t)))))
     (propagated-inputs
      `(("python-axolotl-curve25519" ,python-axolotl-curve25519)
        ("python-dateutil" ,python-dateutil)
@@ -12321,6 +13000,12 @@ asynchronous messaging environments.")
           (base32
             "17wzkkcqy5zc0g68xlad3kcv66iw14d2pwqc0h9420gak0vbhx7g"))))
     (build-system python-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _
+             (zero? (system* "python" "test3.py")))))))
     (home-page "http://github.com/gfxmonk/termstyle")
     (synopsis "Console text coloring for Python")
     (description "This package provides console text coloring for Python.")
@@ -12371,6 +13056,13 @@ asynchronous messaging environments.")
           (base32
             "11his6ii5brpkhld0d5bwzjjw4q3vmplpd6fmgzjrvvklsbk0cf4"))))
     (build-system python-build-system)
+    (arguments
+     '(#:tests? #f)) ; FIXME: 35/882 tests failing.
+       ;; #:phases
+       ;; (modify-phases %standard-phases
+       ;;   (replace 'check
+       ;;     (lambda _
+       ;;       (zero? (system* "nosetests")))))))
     (propagated-inputs
       `(("python-aniso8601" ,python-aniso8601)
         ("python-flask" ,python-flask)
@@ -12451,6 +13143,9 @@ specs from your Flask-Restful projects.")
           (base32
             "11bwiw6j0nilgz81xnw6f1npyga3prp8asjqrm87cdr3ria5l03x"))))
     (build-system python-build-system)
+    (native-inputs
+     `(("python-pexpect" ,python-pexpect)
+       ("tcsh" ,tcsh)))
     (home-page "https://github.com/kislyuk/argcomplete")
     (synopsis "Shell tab completion for Python argparse")
     (description "argcomplete provides extensible command line tab completion
@@ -12532,6 +13227,52 @@ Features:
 @end enumerate")
     (license (license:x11-style "file://LICENSE"))))
 
+(define-public python-dulwich
+  (package
+    (name "python-dulwich")
+    (version "0.16.3")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (list (string-append "https://www.dulwich.io/releases/"
+                            "dulwich-" version ".tar.gz")
+                   (pypi-uri "dulwich" version)))
+        (sha256
+          (base32 "0fl47vzfgc3w3rmhn8naii905cjqcp0vc68iyvymxp7567hh6als"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-before 'check 'fix-tests
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; The tests use Popen with a custom environment which doesn't
+             ;; include PATH.
+             (substitute* "dulwich/tests/compat/utils.py"
+               (("'git'") (string-append "'"
+                                         (which "git")
+                                         "'")))
+             (substitute* '("dulwich/tests/test_repository.py"
+                            "dulwich/tests/test_hooks.py")
+               (("#!/bin/sh") (string-append "#!" (which "sh"))))
+             (setenv "TEST_RUNNER" "unittest")
+             (setenv "PYTHONHASHSEED" "random")
+             #t)))))
+    (propagated-inputs
+     `(("python-fastimport" ,python-fastimport)))
+    (native-inputs
+     `(("python-mock" ,python-mock)
+       ("python-geventhttpclient" ,python-geventhttpclient)
+       ("git" ,git)))
+    (home-page "https://www.dulwich.io/")
+    (synopsis "Git implementation in Python")
+    (description "Dulwich is an implementation of the Git file formats and
+protocols written in pure Python.")
+    ;; Can be used with either license.
+    (license (list license:asl2.0 license:gpl2+))))
+
+(define-public python2-dulwich
+  (package-with-python2 python-dulwich))
+
 (define-public python-pbkdf2
   (package
     (name "python-pbkdf2")
@@ -12544,6 +13285,15 @@ Features:
         (base32
          "0yb99rl2mbsaamj571s1mf6vgniqh23v98k4632150hjkwv9fqxc"))))
     (build-system python-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _
+             (setenv "PYTHONPATH"
+                     (string-append (getcwd) "/build/lib:"
+                                    (getenv "PYTHONPATH")))
+             (zero? (system* "python" "test/test_pbkdf2.py")))))))
     (propagated-inputs
      `(("python-pycrypto" ,python-pycrypto)))  ; optional
     (home-page "http://www.dlitz.net/software/python-pbkdf2/")
@@ -12573,6 +13323,9 @@ a file-like object from which an arbitrarly-sized key can be read.")
         (base32
          "0kljfrfq0c2rmxf8am57333ia41kd0snbm2rnqbdy816hgpcq5a1"))))
     (build-system python-build-system)
+    (arguments
+     ;; FIXME: Tests require packaging 'pymaging'.
+     '(#:tests? #f))
     (propagated-inputs
      `(("python-lxml" ,python-lxml)     ; for SVG output
        ("python-pillow" ,python-pillow) ; for PNG output