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