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