1{ stdenv
2, lib
3, buildPythonPackage
4, fetchPypi
5, pythonOlder
6, pytest
7, cython
8, cymem
9, darwin
10, msgpack-numpy
11, msgpack-python
12, preshed
13, numpy
14, murmurhash
15, pathlib
16, hypothesis
17, tqdm
18, cytoolz
19, plac
20, six
21, mock
22, wrapt
23, dill
24}:
25
26buildPythonPackage rec {
27 pname = "thinc";
28 version = "6.12.1";
29
30 src = fetchPypi {
31 inherit pname version;
32 sha256 = "1kkp8b3xcs3yn3ia5sxrh086c9xv27s2khdxd17abdypxxa99ich";
33 };
34
35 buildInputs = lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
36 Accelerate CoreFoundation CoreGraphics CoreVideo
37 ]);
38
39 propagatedBuildInputs = [
40 cython
41 cymem
42 msgpack-numpy
43 msgpack-python
44 preshed
45 numpy
46 murmurhash
47 tqdm
48 cytoolz
49 plac
50 six
51 wrapt
52 dill
53 ] ++ lib.optional (pythonOlder "3.4") pathlib;
54
55
56 checkInputs = [
57 hypothesis
58 mock
59 pytest
60 ];
61
62 prePatch = ''
63 substituteInPlace setup.py \
64 --replace "pathlib==1.0.1" "pathlib>=1.0.0,<2.0.0" \
65 --replace "plac>=0.9.6,<1.0.0" "plac>=0.9.6" \
66 --replace "msgpack-numpy<0.4.4" "msgpack-numpy" \
67 --replace "wheel>=0.32.0,<0.33.0" "wheel" \
68 --replace "wrapt>=1.10.0,<1.11.0" "wrapt" \
69 --replace "msgpack>=0.5.6,<0.6.0" "msgpack"
70 '';
71
72 # Cannot find cython modules.
73 doCheck = false;
74
75 checkPhase = ''
76 pytest thinc/tests
77 '';
78
79 meta = with stdenv.lib; {
80 description = "Practical Machine Learning for NLP in Python";
81 homepage = https://github.com/explosion/thinc;
82 license = licenses.mit;
83 maintainers = with maintainers; [ aborsu sdll ];
84 };
85}