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, pydantic
20, srsly
21, tqdm
22, wasabi
23}:
24
25buildPythonPackage rec {
26 pname = "thinc";
27 version = "8.0.3";
28
29 src = fetchPypi {
30 inherit pname version;
31 hash = "sha256-w3CnpG0BtYjY1fmdjV42s8usRRJjg1b6Qw9/Urs6iJc=";
32 };
33
34 buildInputs = [ cython ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
35 Accelerate
36 CoreFoundation
37 CoreGraphics
38 CoreVideo
39 ]);
40
41 propagatedBuildInputs = [
42 blis
43 catalogue
44 cymem
45 murmurhash
46 numpy
47 plac
48 preshed
49 srsly
50 tqdm
51 pydantic
52 wasabi
53 ] ++ lib.optional (pythonOlder "3.4") pathlib;
54
55
56 checkInputs = [
57 hypothesis
58 mock
59 pytest
60 ];
61
62 # Cannot find cython modules.
63 doCheck = false;
64
65 postPatch = ''
66 substituteInPlace setup.cfg \
67 --replace "blis>=0.4.0,<0.8.0" "blis>=0.4.0,<1.0" \
68 --replace "pydantic>=1.7.1,<1.8.0" "pydantic~=1.7"
69 '';
70
71 checkPhase = ''
72 pytest thinc/tests
73 '';
74
75 pythonImportsCheck = [ "thinc" ];
76
77 meta = with lib; {
78 description = "Practical Machine Learning for NLP in Python";
79 homepage = "https://github.com/explosion/thinc";
80 license = licenses.mit;
81 maintainers = with maintainers; [ aborsu sdll ];
82 };
83}