1{
2 lib,
3 stdenv,
4 blis,
5 buildPythonPackage,
6 callPackage,
7 catalogue,
8 cymem,
9 cython_0,
10 fetchPypi,
11 hypothesis,
12 jinja2,
13 jsonschema,
14 langcodes,
15 mock,
16 murmurhash,
17 numpy,
18 packaging,
19 pathy,
20 preshed,
21 pydantic,
22 pytestCheckHook,
23 python,
24 pythonOlder,
25 pythonRelaxDepsHook,
26 requests,
27 setuptools,
28 spacy-legacy,
29 spacy-loggers,
30 srsly,
31 thinc,
32 tqdm,
33 typer,
34 typing-extensions,
35 wasabi,
36 weasel,
37 writeScript,
38 nix,
39 git,
40 nix-update,
41}:
42
43buildPythonPackage rec {
44 pname = "spacy";
45 version = "3.7.4";
46 pyproject = true;
47
48 disabled = pythonOlder "3.7";
49
50 src = fetchPypi {
51 inherit pname version;
52 hash = "sha256-Ul8s7S5AdhViyMrOk+9qHm6MSD8nvVZLwbFfYI776Fs=";
53 };
54
55 pythonRelaxDeps = [
56 "smart-open"
57 "typer"
58 ];
59
60 nativeBuildInputs = [
61 pythonRelaxDepsHook
62 cython_0
63 ];
64
65 propagatedBuildInputs = [
66 blis
67 catalogue
68 cymem
69 jinja2
70 jsonschema
71 langcodes
72 murmurhash
73 numpy
74 packaging
75 pathy
76 preshed
77 pydantic
78 requests
79 setuptools
80 spacy-legacy
81 spacy-loggers
82 srsly
83 thinc
84 tqdm
85 typer
86 wasabi
87 weasel
88 ] ++ lib.optionals (pythonOlder "3.8") [ typing-extensions ];
89
90 nativeCheckInputs = [
91 pytestCheckHook
92 hypothesis
93 mock
94 ];
95
96 doCheck = true;
97
98 # Fixes ModuleNotFoundError when running tests on Cythonized code. See #255262
99 preCheck = ''
100 cd $out
101 '';
102
103 pytestFlagsArray = [ "-m 'slow'" ];
104
105 disabledTests = [
106 # touches network
107 "test_download_compatibility"
108 "test_validate_compatibility_table"
109 "test_project_assets"
110 ];
111
112 pythonImportsCheck = [ "spacy" ];
113
114 passthru = {
115 updateScript = writeScript "update-spacy" ''
116 #!${stdenv.shell}
117 set -eou pipefail
118 PATH=${
119 lib.makeBinPath [
120 nix
121 git
122 nix-update
123 ]
124 }
125
126 nix-update python3Packages.spacy
127
128 # update spacy models as well
129 echo | nix-shell maintainers/scripts/update.nix --argstr package python3Packages.spacy-models.en_core_web_sm
130 '';
131 tests.annotation = callPackage ./annotation-test { };
132 };
133
134 meta = with lib; {
135 description = "Industrial-strength Natural Language Processing (NLP)";
136 mainProgram = "spacy";
137 homepage = "https://github.com/explosion/spaCy";
138 changelog = "https://github.com/explosion/spaCy/releases/tag/v${version}";
139 license = licenses.mit;
140 maintainers = with maintainers; [ ];
141 };
142}