summary refs log tree commit diff
diff options
context:
space:
mode:
authorRicardo Wurmus <ricardo.wurmus@mdc-berlin.de>2015-10-12 17:41:58 +0200
committerRicardo Wurmus <ricardo.wurmus@mdc-berlin.de>2015-10-22 17:35:05 +0200
commit9bc08aa0cb65ef0689f06fed7b0859f9fe542ae1 (patch)
tree178eba8daaf18e4552095b01cd49d11981fb0f1e
parent5d47eab0242d6f89a6837123141acdae68745328 (diff)
downloadguix-9bc08aa0cb65ef0689f06fed7b0859f9fe542ae1.tar.gz
gnu: Add python-patsy.
* gnu/packages/statistics.scm (python-patsy, python2-patsy): New
  variables.
-rw-r--r--gnu/packages/statistics.scm58
1 files changed, 57 insertions, 1 deletions
diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm
index f854a44d96..14920944c5 100644
--- a/gnu/packages/statistics.scm
+++ b/gnu/packages/statistics.scm
@@ -24,6 +24,7 @@
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system r)
+  #:use-module (guix build-system python)
   #:use-module (gnu packages)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages gcc)
@@ -35,11 +36,14 @@
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages texlive)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages base)
-  #:use-module (gnu packages xorg))
+  #:use-module (gnu packages xorg)
+  #:use-module (gnu packages zip)
+  #:use-module (srfi srfi-1))
 
 (define-public r
   (package
@@ -933,3 +937,55 @@ times.")
 large data (e.g. 100GB in RAM), fast ordered joins, fast add/modify/delete of
 columns by group, column listing and fast file reading.")
     (license license:gpl2+)))
+
+(define-public python-patsy
+  (package
+    (name "python-patsy")
+    (version "0.4.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://pypi.python.org/packages/source/"
+                                  "p/patsy/patsy-" version ".zip"))
+              (sha256
+               (base32
+                "1kbs996xc2haxalmhd19rr1wh5fa4gbbxf81czkf5w4kam7h7wz4"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'check (lambda _ (zero? (system* "nosetests" "-v"))))
+         (add-after 'unpack 'prevent-generation-of-egg-archive
+          (lambda _
+            (substitute* "setup.py"
+              (("from setuptools import setup")
+               "from distutils.core import setup"))
+            #t)))))
+    (propagated-inputs
+     `(("python-numpy" ,python-numpy)
+       ("python-scipy" ,python-scipy)
+       ("python-six" ,python-six)))
+    (native-inputs
+     `(("python-nose" ,python-nose)
+       ("unzip" ,unzip)))
+    (home-page "https://github.com/pydata/patsy")
+    (synopsis "Describe statistical models and build design matrices")
+    (description
+     "Patsy is a Python package for describing statistical models and for
+building design matrices.")
+    ;; The majority of the code is distributed under BSD-2.  The module
+    ;; patsy.compat contains code derived from the Python standard library,
+    ;; and is covered by the PSFL.
+    (license (list license:bsd-2 license:psfl))))
+
+(define-public python2-patsy
+  (let ((patsy (package-with-python2 python-patsy)))
+    (package (inherit patsy)
+      (native-inputs
+       `(("python2-setuptools" ,python2-setuptools)
+         ,@(package-native-inputs patsy)))
+      (propagated-inputs
+       `(("python2-numpy" ,python2-numpy)
+         ("python2-scipy" ,python2-scipy)
+         ,@(alist-delete "python-numpy"
+                         (alist-delete "python-scipy"
+                                       (package-propagated-inputs patsy))))))))