summary refs log tree commit diff
path: root/pkgs/development/python-modules/thinc/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/thinc/default.nix')
-rw-r--r--pkgs/development/python-modules/thinc/default.nix63
1 files changed, 32 insertions, 31 deletions
diff --git a/pkgs/development/python-modules/thinc/default.nix b/pkgs/development/python-modules/thinc/default.nix
index 15794caf58b..2c6df953e16 100644
--- a/pkgs/development/python-modules/thinc/default.nix
+++ b/pkgs/development/python-modules/thinc/default.nix
@@ -1,15 +1,19 @@
 { stdenv
+, lib
 , pkgs
 , buildPythonPackage
 , fetchPypi
-, fetchFromGitHub
+, pythonOlder
 , pytest
 , cython
 , cymem
+, msgpack-numpy
+, msgpack-python
 , preshed
 , numpy
 , python
 , murmurhash
+, pathlib
 , hypothesis
 , tqdm
 , cytoolz
@@ -21,36 +25,21 @@
 , dill
 }:
 
-let
-  enableDebugging = true;
-
-  pathlibLocked = buildPythonPackage rec {
-    name = "${pname}-${version}";
-    pname = "pathlib";
-    version = "1.0.1";
-
-    src = fetchPypi {
-      inherit pname version;
-      sha256 = "17zajiw4mjbkkv6ahp3xf025qglkj0805m9s41c45zryzj6p2h39";
-    };
-
-    doCheck = false; # fails to import support from test
-  };
-in buildPythonPackage rec {
+buildPythonPackage rec {
   pname = "thinc";
-  version = "6.5.1";
+  version = "6.10.2";
   name = pname + "-" + version;
 
-  src = fetchFromGitHub {
-    owner = "explosion";
-    repo = "thinc";
-    rev = "v${version}";
-    sha256 = "008kmjsvanh6qgnpvsn3qacfcyprxirxbw4yfd8flyg7mxw793ws";
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "0xia81wvfrhyriywab184s49g8rpl42vcf5fy3x6xxw50a2yn7cs";
   };
 
   propagatedBuildInputs = [
    cython
    cymem
+   msgpack-numpy
+   msgpack-python
    preshed
    numpy
    murmurhash
@@ -64,22 +53,34 @@ in buildPythonPackage rec {
    termcolor
    wrapt
    dill
-   pathlibLocked
+  ] ++ lib.optional (pythonOlder "3.4") pathlib;
+
+
+  checkInputs = [
+    pytest
   ];
 
+  prePatch = ''
+    substituteInPlace setup.py --replace \
+      "'pathlib>=1.0.0,<2.0.0'," \
+      "\"pathlib>=1.0.0,<2.0.0; python_version<'3.4'\","
+
+    substituteInPlace setup.py --replace \
+      "'cytoolz>=0.8,<0.9'," \
+      "'cytoolz>=0.8',"
+  '';
+
+  # Cannot find cython modules.
   doCheck = false;
 
-  # fails to import some modules
-  # checkPhase = ''
-  #   ${python.interpreter} -m pytest thinc/tests
-  #   # cd thinc/tests
-  #   # ${python.interpreter} -m unittest discover -p "*test*"
-  # '';
+  checkPhase = ''
+    pytest thinc/tests
+  '';
 
   meta = with stdenv.lib; {
     description = "Practical Machine Learning for NLP in Python";
     homepage = https://github.com/explosion/thinc;
     license = licenses.mit;
-    maintainers = with maintainers; [ sdll ];
+    maintainers = with maintainers; [ aborsu sdll ];
     };
 }