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