1{ lib
2, blis
3, buildPythonPackage
4, callPackage
5, catalogue
6, cymem
7, fetchPypi
8, jinja2
9, jsonschema
10, langcodes
11, murmurhash
12, numpy
13, packaging
14, pathy
15, preshed
16, pydantic
17, pytest
18, python
19, pythonOlder
20, requests
21, setuptools
22, spacy-legacy
23, spacy-loggers
24, srsly
25, thinc
26, tqdm
27, typer
28, typing-extensions
29, wasabi
30, writeScript
31, stdenv
32, nix
33, git
34, nix-update
35}:
36
37buildPythonPackage rec {
38 pname = "spacy";
39 version = "3.5.2";
40 format = "setuptools";
41
42 disabled = pythonOlder "3.6";
43
44 src = fetchPypi {
45 inherit pname version;
46 hash = "sha256-IsH/qrKFt0dwA9S1sDhBTMMkaKaQ1HkBW5ppjFMcgTs=";
47 };
48
49 propagatedBuildInputs = [
50 blis
51 catalogue
52 cymem
53 jinja2
54 jsonschema
55 langcodes
56 murmurhash
57 numpy
58 packaging
59 pathy
60 preshed
61 pydantic
62 requests
63 setuptools
64 spacy-legacy
65 spacy-loggers
66 srsly
67 thinc
68 tqdm
69 typer
70 wasabi
71 ] ++ lib.optionals (pythonOlder "3.8") [
72 typing-extensions
73 ];
74
75 postPatch = ''
76 substituteInPlace setup.cfg \
77 --replace "typer>=0.3.0,<0.5.0" "typer>=0.3.0"
78 '';
79
80 nativeCheckInputs = [
81 pytest
82 ];
83
84 doCheck = false;
85 checkPhase = ''
86 ${python.interpreter} -m pytest spacy/tests --vectors --models --slow
87 '';
88
89 pythonImportsCheck = [
90 "spacy"
91 ];
92
93 passthru = {
94 updateScript = writeScript "update-spacy" ''
95 #!${stdenv.shell}
96 set -eou pipefail
97 PATH=${lib.makeBinPath [ nix git nix-update ]}
98
99 nix-update python3Packages.spacy
100
101 # update spacy models as well
102 echo | nix-shell maintainers/scripts/update.nix --argstr package python3Packages.spacy_models.en_core_web_sm
103 '';
104 tests.annotation = callPackage ./annotation-test { };
105 };
106
107 meta = with lib; {
108 description = "Industrial-strength Natural Language Processing (NLP)";
109 homepage = "https://github.com/explosion/spaCy";
110 changelog = "https://github.com/explosion/spaCy/releases/tag/v${version}";
111 license = licenses.mit;
112 maintainers = with maintainers; [ ];
113 };
114}