gnu: Add python2-pysnptools.
[jackhill/guix/guix.git] / gnu / packages / python.scm
index f876ccf..7ddfcc6 100644 (file)
@@ -26,7 +26,7 @@
 
 (define-module (gnu packages python)
   #:use-module ((guix licenses)
-                #:select (asl2.0 bsd-3 bsd-2 non-copyleft cc0 x11 x11-style
+                #:select (asl2.0 bsd-4 bsd-3 bsd-2 non-copyleft cc0 x11 x11-style
                           gpl2 gpl2+ gpl3+ lgpl2.0+ lgpl2.1 lgpl2.1+ lgpl3+
                           psfl public-domain x11-style))
   #:use-module ((guix licenses) #:select (expat zlib) #:prefix license:)
@@ -45,6 +45,7 @@
   #:use-module (gnu packages libffi)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages multiprecision)
+  #:use-module (gnu packages networking)
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages openssl)
   #:use-module (gnu packages perl)
@@ -206,7 +207,9 @@ data types.")
               (method url-fetch)
               (uri (string-append "https://www.python.org/ftp/python/"
                                   version "/Python-" version ".tar.xz"))
-              (patches (list (search-patch "python-fix-tests.patch")))
+              (patches (list (search-patch "python-fix-tests.patch")
+                             ;; XXX Try removing this patch for python > 3.4.3
+                             (search-patch "python-disable-ssl-test.patch")))
               (patch-flags '("-p0"))
               (sha256
                (base32
@@ -1636,6 +1639,33 @@ is used by the Requests library to verify HTTPS requests.")
 (define-public python2-certifi
   (package-with-python2 python-certifi))
 
+(define-public python-click
+  (package
+    (name "python-click")
+    (version "4.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://pypi.python.org/packages/source/c/click/click-"
+             version ".tar.gz"))
+       (sha256
+        (base32 "0294x9g28w6zgswl0rsygkwi0wf6n480gf7fiiw5f9az3xhh77pl"))))
+    (build-system python-build-system)
+    (native-inputs
+     `(("python-setuptools" ,python-setuptools)))
+    (home-page "http://click.pocoo.org")
+    (synopsis "Command line library for Python")
+    (description
+     "Click is a Python package for creating command line interfaces in a
+composable way with as little code as necessary.  Its name stands for
+\"Command Line Interface Creation Kit\".  It's highly configurable but comes
+with sensible defaults out of the box.")
+    (license bsd-3)))
+
+(define-public python2-click
+  (package-with-python2 python-click))
+
 (define-public python-requests
   (package
     (name "python-requests")
@@ -2038,7 +2068,7 @@ sources.")
 (define-public python-scikit-learn
   (package
     (name "python-scikit-learn")
-    (version "0.15.2")
+    (version "0.16.1")
     (source
      (origin
        (method url-fetch)
@@ -2047,40 +2077,27 @@ sources.")
              version ".tar.gz"))
        (sha256
         (base32
-         "1rb93h2q15f219sz60sczjb65rg70xjmnp0q4pkkaairx5s05q55"))))
+         "140skabifgc7lvvj873pnzlwx0ni6q8qkrsyad2ccjb3h8rxzkih"))))
     (build-system python-build-system)
     (arguments
      `(#:phases
        (alist-cons-before
-        'build 'set-environment-variables
-        (lambda* (#:key inputs #:allow-other-keys)
-          (let* ((atlas-threaded
-                  (string-append (assoc-ref inputs "atlas")
-                                 "/lib/libtatlas.so"))
-                 ;; On single core CPUs only the serial library is created.
-                 (atlas-lib
-                  (if (file-exists? atlas-threaded)
-                      atlas-threaded
-                      (string-append (assoc-ref inputs "atlas")
-                                     "/lib/libsatlas.so"))))
-            (setenv "ATLAS" atlas-lib)))
-        (alist-cons-before
-         'check 'set-HOME
-         ;; some tests require access to "$HOME"
-         (lambda _ (setenv "HOME" "/tmp"))
-         ;; 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"
-              ;; With Python 3 one test of 3334 fails
-              ;; (sklearn.tests.test_common.test_transformers); see
-              ;; https://github.com/scikit-learn/scikit-learn/issues/3693
-              (system* "nosetests" "-v" "sklearn")))
-          (alist-delete 'check %standard-phases))))))
+        'check 'set-HOME
+        ;; some tests require access to "$HOME"
+        (lambda _ (setenv "HOME" "/tmp"))
+        ;; 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"
+             ;; With Python 3 one test of 3334 fails
+             ;; (sklearn.tests.test_common.test_transformers); see
+             ;; https://github.com/scikit-learn/scikit-learn/issues/3693
+             (system* "nosetests" "-v" "sklearn")))
+         (alist-delete 'check %standard-phases)))))
     (inputs
-     `(("atlas" ,atlas)
+     `(("openblas" ,openblas)
        ("python-nose" ,python-nose)))
     (propagated-inputs
      `(("python-numpy" ,python-numpy)
@@ -2142,6 +2159,62 @@ mining and data analysis.")
        `(("python2-pytz" ,python2-pytz)
          ,@(package-propagated-inputs scikit-image))))))
 
+(define-public python-redis
+  (package
+    (name "python-redis")
+    (version "2.10.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://pypi.python.org/packages/source/r/redis/redis-"
+             version ".tar.gz"))
+       (sha256
+        (base32 "1701qjwn4n05q90fdg4bsg96s27xf5s4hsb4gxhv3xk052q3gyx4"))))
+    (build-system python-build-system)
+    ;; Tests require a running Redis server
+    (arguments '(#:tests? #f))
+    (native-inputs
+     `(("python-setuptools" ,python-setuptools)
+       ("python-pytest" ,python-pytest)))
+    (home-page "https://github.com/andymccurdy/redis-py")
+    (synopsis "Redis Python client")
+    (description
+     "This package provides a Python interface to the Redis key-value store.")
+    (license license:expat)))
+
+(define-public python2-redis
+  (package-with-python2 python-redis))
+
+(define-public python-rq
+  (package
+    (name "python-rq")
+    (version "0.5.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://pypi.python.org/packages/source/r/rq/rq-"
+             version ".tar.gz"))
+       (sha256
+        (base32 "0b0z5hn8wkfg300hx7816csgv3bcfamlr29fi3yzgqmpqxwj3fix"))))
+    (build-system python-build-system)
+    (propagated-inputs
+     `(("python-click" ,python-click)
+       ("python-redis" ,python-redis)))
+    (native-inputs
+     `(("python-setuptools" ,python-setuptools)))
+    (home-page "http://python-rq.org/")
+    (synopsis "Simple job queues for Python")
+    (description
+     "RQ (Redis Queue) is a simple Python library for queueing jobs and
+processing them in the background with workers.  It is backed by Redis and it
+is designed to have a low barrier to entry.")
+    (license bsd-2)))
+
+(define-public python2-rq
+  (package-with-python2 python-rq))
+
 (define-public python-cython
   (package
     (name "python-cython")
@@ -2199,24 +2272,37 @@ writing C extensions for Python as easy as Python itself.")
     (build-system python-build-system)
     (inputs
      `(("python-nose" ,python-nose)
-       ("atlas" ,atlas)))
+       ("openblas" ,openblas)
+       ("lapack" ,lapack)))
     (native-inputs
-     `(("gfortran" ,gfortran-4.8)))
+     `(("gfortran" ,gfortran)))
     (arguments
      `(#:phases
        (alist-cons-before
         'build 'set-environment-variables
         (lambda* (#:key inputs #:allow-other-keys)
-          (let* ((atlas-threaded
-                  (string-append (assoc-ref inputs "atlas")
-                                 "/lib/libtatlas.so"))
-                 ;; On single core CPUs only the serial library is created.
-                 (atlas-lib
-                  (if (file-exists? atlas-threaded)
-                      atlas-threaded
-                      (string-append (assoc-ref inputs "atlas")
-                                     "/lib/libsatlas.so"))))
-            (setenv "ATLAS" atlas-lib)))
+          (call-with-output-file "site.cfg"
+            (lambda (port)
+              (format port
+                      "[openblas]
+libraries = openblas
+library_dirs = ~a/lib
+include_dirs = ~a/include
+
+[lapack]
+lapack_libs = lapack
+library_dirs = ~a/lib
+include_dirs = ~a/include
+"
+                      (assoc-ref inputs "openblas")
+                      (assoc-ref inputs "openblas")
+                      (assoc-ref inputs "lapack")
+                      (assoc-ref inputs "lapack"))))
+          ;; Use "gcc" executable, not "cc".
+          (substitute* "numpy/distutils/system_info.py"
+            (("c = distutils\\.ccompiler\\.new_compiler\\(\\)")
+             "c = distutils.ccompiler.new_compiler(); c.set_executables(compiler='gcc',compiler_so='gcc',linker_exe='gcc',linker_so='gcc -shared')"))
+          #t)
         ;; Tests can only be run after the library has been installed and not
         ;; within the source directory.
         (alist-cons-after
@@ -2512,6 +2598,39 @@ toolkits.")
                                        (package-propagated-inputs
                                         matplotlib))))))))
 
+(define-public python2-pysnptools
+  (package
+    (name "python2-pysnptools")
+    (version "0.2.13")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://pypi.python.org/packages/source/p/pysnptools"
+             "/pysnptools-" version ".zip"))
+       (sha256
+        (base32
+         "1rzf5qvwfvd2pp84b14pb2gdvxdk5avnj7rb41ac8gndpkr9g6ib"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:python ,python-2)) ; only Python 2.7 is supported
+    (propagated-inputs
+     `(("python2-numpy" ,python2-numpy)
+       ("python2-scipy" ,python2-scipy)
+       ("python2-pandas" ,python2-pandas)
+       ("python2-cython" ,python2-cython)))
+    (native-inputs
+     `(("unzip" ,unzip)
+       ("python2-setuptools" ,python2-setuptools)))
+    (home-page "http://research.microsoft.com/en-us/um/redmond/projects/mscompbio/")
+    (synopsis "Library for reading and manipulating genetic data")
+    (description
+     "PySnpTools is a library for reading and manipulating genetic data.  It
+can, for example, efficiently read whole PLINK *.bed/bim/fam files or parts of
+those files.  It can also efficiently manipulate ranges of integers using set
+operators such as union, intersection, and difference.")
+    (license asl2.0)))
+
 (define-public python-scipy
   (package
     (name "python-scipy")
@@ -2531,27 +2650,33 @@ toolkits.")
        ("python-pyparsing" ,python-pyparsing)
        ("python-nose" ,python-nose)
        ("python-sphinx" ,python-sphinx)
-       ("atlas" ,atlas)))
+       ("lapack" ,lapack)
+       ("openblas" ,openblas)))
     (native-inputs
-     `(("gfortran" ,gfortran-4.8)
+     `(("gfortran" ,gfortran)
        ("texlive" ,texlive)
        ("perl" ,perl)))
     (outputs '("out" "doc"))
     (arguments
      `(#:phases
        (alist-cons-before
-        'build 'set-environment-variables
+        'build 'configure-openblas
         (lambda* (#:key inputs #:allow-other-keys)
-          (let* ((atlas-threaded
-                  (string-append (assoc-ref inputs "atlas")
-                                 "/lib/libtatlas.so"))
-                 ;; On single core CPUs only the serial library is created.
-                 (atlas-lib
-                  (if (file-exists? atlas-threaded)
-                      atlas-threaded
-                      (string-append (assoc-ref inputs "atlas")
-                                     "/lib/libsatlas.so"))))
-            (setenv "ATLAS" atlas-lib)))
+          (call-with-output-file "site.cfg"
+            (lambda (port)
+              (format port
+                      "[blas]
+libraries = openblas
+library_dirs = ~a/lib
+include_dirs = ~a/include
+[atlas]
+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 outputs #:allow-other-keys)
@@ -2704,7 +2829,7 @@ services for your Python modules and applications.")
 (define-public python-pillow
   (package
     (name "python-pillow")
-    (version "2.6.1")
+    (version "2.8.1")
     (source
      (origin
        (method url-fetch)
@@ -2712,17 +2837,19 @@ services for your Python modules and applications.")
                            "Pillow/Pillow-" version ".tar.gz"))
        (sha256
         (base32
-         "0iw36c73wkhz88wa78v6l43llsb080ihw8yq7adhfqxdib7l4hzr"))))
+         "15n92axxph2s3kvg68bki9gv3nzwgq7130kp7wbblpi1l0cc2q47"))))
     (build-system python-build-system)
     (native-inputs
      `(("python-setuptools" ,python-setuptools)
        ("python-nose"       ,python-nose)))
     (inputs
-     `(("lcms"     ,lcms)
+     `(("freetype" ,freetype)
+       ("lcms"     ,lcms)
        ("zlib"     ,zlib)
        ("libjpeg"  ,libjpeg)
        ("openjpeg" ,openjpeg)
-       ("libtiff"  ,libtiff)))
+       ("libtiff"  ,libtiff)
+       ("libwebp"  ,libwebp)))
     (propagated-inputs
      `(;; Used at runtime for pkg_resources
        ("python-setuptools" ,python-setuptools)))
@@ -3190,9 +3317,7 @@ features useful for text console applications.")
      `(("pkg-config" ,pkg-config)))
     (inputs
      `(("python" ,python)
-       ("dbus" ,dbus)
-       ("dbus-glib" ,dbus-glib)
-       ("glib" ,glib)))
+       ("dbus-glib" ,dbus-glib)))
     (synopsis "Python bindings for D-bus")
     (description "python-dbus provides bindings for libdbus, the reference
 implementation of D-Bus.")
@@ -3278,43 +3403,6 @@ libxml2 and libxslt.")
 (define-public python2-lxml
   (package-with-python2 python-lxml))
 
-(define-public python-pillow
-  (package
-    (name "python-pillow")
-    (version "2.7.0")
-    (source
-      (origin
-        (method url-fetch)
-        (uri (string-append
-              "https://pypi.python.org/packages/source/P/Pillow/Pillow-"
-              version
-              ".tar.gz"))
-        (sha256
-          (base32
-            "1y0rysgd7vqpl5lh0lsra7j2k30azwxqlh5jnqk1i0pmfc735s96"))))
-    (build-system python-build-system)
-    (inputs
-      `(("freetype" ,freetype)
-        ("lcms" ,lcms)
-        ("libjpeg" ,libjpeg)
-        ("libtiff" ,libtiff)
-        ("openjpeg" ,openjpeg)
-        ("python-setuptools" ,python-setuptools)
-        ("zlib" ,zlib)))
-    (arguments
-     `(#:tests? #f)) ; no check target
-    (home-page "http://python-pillow.github.io/")
-    (synopsis "Pillow fork of Python Imaging Library")
-    (description "Pillow is a fork of the Python Imaging Library (PIL).")
-    ;; PIL license, see
-    ;; http://www.pythonware.com/products/pil/license.htm
-    (license (x11-style
-               "file://PKG-INFO"
-               "See http://www.pythonware.com/products/pil/license.htm"))))
-
-(define-public python2-pillow
-  (package-with-python2 python-pillow))
-
 (define-public python2-pil
   (package
     (name "python2-pil")
@@ -3523,6 +3611,41 @@ providing a clean and modern domain specific specification language (DSL) in
 Python style, together with a fast and comfortable execution environment.")
     (license license:expat)))
 
+(define-public python-seaborn
+  (package
+    (name "python-seaborn")
+    (version "0.5.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://pypi.python.org/packages/source/s/seaborn/seaborn-"
+             version ".tar.gz"))
+       (sha256
+        (base32 "1236abw18ijjglmv60q85ckqrvgf5qyy4zlq7nz5aqfg6q87z3wc"))))
+    (build-system python-build-system)
+    (propagated-inputs
+     `(("python-pandas" ,python-pandas)
+       ("python-matplotlib" ,python-matplotlib)
+       ("python-scipy" ,python-scipy)))
+    (native-inputs
+     `(("python-setuptools" ,python-setuptools)))
+    (home-page "http://stanford.edu/~mwaskom/software/seaborn/")
+    (synopsis "Statistical data visualization")
+    (description
+     "Seaborn is a library for making attractive and informative statistical
+graphics in Python.  It is built on top of matplotlib and tightly integrated
+with the PyData stack, including support for numpy and pandas data structures
+and statistical routines from scipy and statsmodels.")
+    (license bsd-3)))
+
+(define-public python2-seaborn
+  (let ((seaborn (package-with-python2 python-seaborn)))
+    (package (inherit seaborn)
+      (propagated-inputs
+       `(("python2-pytz" ,python2-pytz)
+         ,@(package-propagated-inputs seaborn))))))
+
 (define-public python-sympy
   (package
     (name "python-sympy")
@@ -3709,3 +3832,37 @@ applications.")
 
 (define-public python2-waf
   (package-with-python2 python-waf))
+
+(define-public python-pyzmq
+  (package
+    (name "python-pyzmq")
+    (version "14.6.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://pypi.python.org/packages/source/p/pyzmq/pyzmq-"
+             version ".tar.gz"))
+       (sha256
+        (base32 "1frmbjykvhmdg64g7sn20c9fpamrsfxwci1nhhg8q7jgz5pq0ikp"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:configure-flags
+       (list (string-append "--zmq=" (assoc-ref %build-inputs "zeromq")))
+       ;; FIXME: You must build pyzmq with 'python setup.py build_ext
+       ;; --inplace' for 'python setup.py test' to work.
+       #:tests? #f))
+    (inputs
+     `(("zeromq" ,zeromq)))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("python-nose" ,python-nose)
+       ("python-setuptools" ,python-setuptools)))
+    (home-page "http://github.com/zeromq/pyzmq")
+    (synopsis "Python bindings for 0MQ")
+    (description
+     "PyZMQ is the official Python binding for the ZeroMQ messaging library.")
+    (license bsd-4)))
+
+(define-public python2-pyzmq
+  (package-with-python2 python-pyzmq))