1{ lib
2, stdenv
3, Accelerate
4, blis
5, buildPythonPackage
6, catalogue
7, confection
8, contextvars
9, CoreFoundation
10, CoreGraphics
11, CoreVideo
12, cymem
13, cython
14, dataclasses
15, fetchPypi
16, hypothesis
17, mock
18, murmurhash
19, numpy
20, plac
21, preshed
22, pydantic
23, pytestCheckHook
24, python
25, pythonOlder
26, srsly
27, tqdm
28, typing-extensions
29, wasabi
30}:
31
32buildPythonPackage rec {
33 pname = "thinc";
34 version = "8.1.1";
35 format = "setuptools";
36
37 disabled = pythonOlder "3.6";
38
39 src = fetchPypi {
40 inherit pname version;
41 hash = "sha256-m5AoKYTzy6rJjgNn3xsa+eSDYjG8Bj361yQqnQ3VK80=";
42 };
43
44 buildInputs = [
45 cython
46 ] ++ lib.optionals stdenv.isDarwin [
47 Accelerate
48 CoreFoundation
49 CoreGraphics
50 CoreVideo
51 ];
52
53 propagatedBuildInputs = [
54 blis
55 catalogue
56 confection
57 cymem
58 murmurhash
59 numpy
60 plac
61 preshed
62 pydantic
63 srsly
64 tqdm
65 wasabi
66 ] ++ lib.optionals (pythonOlder "3.8") [
67 typing-extensions
68 ] ++ lib.optionals (pythonOlder "3.7") [
69 contextvars
70 dataclasses
71 ];
72
73 checkInputs = [
74 hypothesis
75 mock
76 pytestCheckHook
77 ];
78
79 # Add native extensions.
80 preCheck = ''
81 export PYTHONPATH=$out/${python.sitePackages}:$PYTHONPATH
82
83 # avoid local paths, relative imports wont resolve correctly
84 mv thinc/tests tests
85 rm -r thinc
86 '';
87
88 pythonImportsCheck = [
89 "thinc"
90 ];
91
92 meta = with lib; {
93 description = "Library for NLP machine learning";
94 homepage = "https://github.com/explosion/thinc";
95 license = licenses.mit;
96 maintainers = with maintainers; [ aborsu ];
97 };
98}