git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #36899 from aborsu/spacy

Spacy

commitd78a411d98685cc7f918908187068b742183109b authorRobert Schütz <rschuetz17@gmail.com> dateWed 14 Mar 2018, 23:36 (9 years ago) parent0c8e8ce22fdb0b
7 files changed+135−73
maintainers/maintainer-list.nix+5 pkgs/development/python-modules/ftfy/default.nix+12−10 pkgs/development/python-modules/msgpack-numpy/default.nix+38 pkgs/development/python-modules/murmurhash/default.nix+11−12 pkgs/development/python-modules/spacy/default.nix+35−20 pkgs/development/python-modules/thinc/default.nix+32−31 pkgs/top-level/python-packages.nix+2
maintainers/maintainer-list.nix+5
@@ -176,6 +176,11 @@
176176 github = "abigailbuccaneer";
177177 name = "Abigail Bunyan";
178178 };
179+ aborsu = {
180+ email = "a.borsu@gmail.com";
181+ github = "aborsu";
182+ name = "Augustin Borsu";
183+ };
179184 aboseley = {
180185 email = "adam.boseley@gmail.com";
181186 github = "aboseley";
pkgs/development/python-modules/ftfy/default.nix+12−10
@@ -7,18 +7,23 @@
77, python
88, isPy3k
99}:
10+
1011buildPythonPackage rec {
11− name = "${pname}-${version}";
1212 pname = "ftfy";
13− # latest is 5.1.1, buy spaCy requires 4.4.3
14− version = "5.3.0";
13+
14+ version = "4.4.3";
15+ # ftfy v5 only supports python3. Since at the moment the only
16+ # packages that use ftfy are spacy and textacy which both support
17+ # python 2 and 3, they have pinned ftfy to the v4 branch.
18+ # I propose to stick to v4 until another package requires v5.
19+ # At that point we can make a ftfy_v4 package.
1520
1621 src = fetchPypi {
1722 inherit pname version;
18− sha256 = "0ba702d5138f9b35df32b55920c9466208608108f1f3d5de1a68c17e3d68cb7f";
23+ sha256 = "152xdb56rhs1q4r0ck1n557sbphw7zq18r75a7kkd159ckdnc01w";
1924 };
2025
21− propagatedBuildInputs = [ html5lib wcwidth];
26+ propagatedBuildInputs = [ html5lib wcwidth ];
2227
2328 checkInputs = [
2429 nose
@@ -32,13 +37,10 @@ buildPythonPackage rec {
3237 # FileNotFoundError: [Errno 2] No such file or directory: 'ftfy'
3338 doCheck = false;
3439
35− # "this version of ftfy is no longer written for Python 2"
36− disabled = !isPy3k;
37−
3840 meta = with stdenv.lib; {
3941 description = "Given Unicode text, make its representation consistent and possibly less broken.";
4042 homepage = https://github.com/LuminosoInsight/python-ftfy/tree/master/tests;
4143 license = licenses.mit;
42− maintainers = with maintainers; [ sdll ];
43− };
44+ maintainers = with maintainers; [ sdll aborsu ];
45+ };
4446}
pkgs/development/python-modules/msgpack-numpy/default.nixnew file+38
@@ -0,0 +1,38 @@
1+{ stdenv
2+, buildPythonPackage
3+, fetchPypi
4+, cython
5+, msgpack-python
6+, numpy
7+, python
8+}:
9+
10+buildPythonPackage rec {
11+ pname = "msgpack-numpy";
12+ version = "0.4.1";
13+
14+ src = fetchPypi {
15+ inherit pname version;
16+ sha256 = "1czf125nixzwskiqiw0145kfj15030sp334cb89gp5w4rz3h7img";
17+ };
18+
19+ buildInputs = [
20+ cython
21+ ];
22+
23+ propagatedBuildInputs = [
24+ msgpack-python
25+ numpy
26+ ];
27+
28+ checkPhase = ''
29+ ${python.interpreter} msgpack_numpy.py
30+ '';
31+
32+ meta = with stdenv.lib; {
33+ description = "Practical Machine Learning for NLP in Python";
34+ homepage = https://github.com/lebedov/msgpack-numpy;
35+ license = licenses.bsd3;
36+ maintainers = with maintainers; [ aborsu ];
37+ };
38+}
pkgs/development/python-modules/murmurhash/default.nix+11−12
@@ -1,35 +1,34 @@
11{ stdenv
22, buildPythonPackage
3−, fetchFromGitHub
3+, fetchPypi
44, cython
55, python
66}:
77
88buildPythonPackage rec {
99 pname = "murmurhash";
10− version = "0.26.4";
11− name = pname + "-" + version;
10+ version = "0.28.0";
1211
13− src = fetchFromGitHub {
14− owner = "explosion";
15− repo = "murmurhash";
16− rev = "0.26.4";
17− sha256 = "0n2j0glhlv2yh3fjgbg4d79j1c1fpchgjd4vnpw908l9mzchhmdv";
12+ src = fetchPypi {
13+ inherit pname version;
14+ sha256 = "16id8jppw8r54wisrlaaiprcszzb7d7lbpnskqn38s8i7vnkf4b5";
1815 };
1916
2017 buildInputs = [
2118 cython
2219 ];
2320
21+ # No test
22+ doCheck = false;
23+
2424 checkPhase = ''
25− cd murmurhash/tests
26− ${python.interpreter} -m unittest discover -p "*test*"
25+ pytest murmurhash
2726 '';
2827
2928 meta = with stdenv.lib; {
3029 description = "Cython bindings for MurmurHash2";
3130 homepage = https://github.com/explosion/murmurhash;
3231 license = licenses.mit;
33− maintainers = with maintainers; [ sdll ];
34− };
32+ maintainers = with maintainers; [ aborsu sdll ];
33+ };
3534}
pkgs/development/python-modules/spacy/default.nix+35−20
@@ -3,12 +3,11 @@
33, buildPythonPackage
44, python
55, fetchPypi
6−, fetchFromGitHub
6+, html5lib
77, pytest
88, cython
9−, cymem
109, preshed
11−, pathlib2
10+, ftfy
1211, numpy
1312, murmurhash
1413, plac
@@ -16,7 +15,6 @@
1615, ujson
1716, dill
1817, requests
19−, ftfy
2018, thinc
2119, pip
2220, regex
@@ -24,32 +22,49 @@
2422
2523buildPythonPackage rec {
2624 pname = "spacy";
27− version = "1.8.2";
25+ version = "2.0.9";
2826
29− src = fetchFromGitHub {
30− owner = "explosion";
31− repo = "spaCy";
32− rev = "v${version}";
33− sha256 = "0v3bmmar31a6968y4wl0lmgnc3829l2mnwd8s959m4pqw1y1w648";
27+ src = fetchPypi {
28+ inherit pname version;
29+ sha256 = "1ihkhflhyz67bp73kfjqfrbcgdxi2msz5asbrh0pkk590c4vmms5";
3430 };
3531
32+ prePatch = ''
33+ substituteInPlace setup.py --replace \
34+ "'html5lib==1.0b8'," \
35+ "'html5lib',"
36+
37+ substituteInPlace setup.py --replace \
38+ "'regex==2017.4.5'," \
39+ "'regex',"
40+
41+ substituteInPlace setup.py --replace \
42+ "'ftfy==2017.4.5'," \
43+ "'ftfy',"
44+
45+ substituteInPlace setup.py --replace \
46+ "'pathlib'," \
47+ "\"pathlib; python_version<'3.4'\","
48+ '';
49+
3650 propagatedBuildInputs = [
3751 cython
38− cymem
39− pathlib2
40− preshed
41− numpy
52+ dill
53+ html5lib
4254 murmurhash
55+ numpy
4356 plac
57+ preshed
58+ regex
59+ requests
4460 six
61+ thinc
4562 ujson
46− dill
47− requests
48− regex
4963 ftfy
50− thinc
51− pytest
52− pip
64+ ];
65+
66+ checkInputs = [
67+ pytest
5368 ];
5469
5570 doCheck = false;
pkgs/development/python-modules/thinc/default.nix+32−31
@@ -1,15 +1,19 @@
11{ stdenv
2+, lib
23, pkgs
34, buildPythonPackage
45, fetchPypi
5−, fetchFromGitHub
6+, pythonOlder
67, pytest
78, cython
89, cymem
10+, msgpack-numpy
11+, msgpack-python
912, preshed
1013, numpy
1114, python
1215, murmurhash
16+, pathlib
1317, hypothesis
1418, tqdm
1519, cytoolz
@@ -21,36 +25,21 @@
2125, dill
2226}:
2327
24−let
25− enableDebugging = true;
26−
27− pathlibLocked = buildPythonPackage rec {
28− name = "${pname}-${version}";
29− pname = "pathlib";
30− version = "1.0.1";
31−
32− src = fetchPypi {
33− inherit pname version;
34− sha256 = "17zajiw4mjbkkv6ahp3xf025qglkj0805m9s41c45zryzj6p2h39";
35− };
36−
37− doCheck = false; # fails to import support from test
38− };
39−in buildPythonPackage rec {
28+buildPythonPackage rec {
4029 pname = "thinc";
41− version = "6.5.1";
30+ version = "6.10.2";
4231 name = pname + "-" + version;
4332
44− src = fetchFromGitHub {
45− owner = "explosion";
46− repo = "thinc";
47− rev = "v${version}";
48− sha256 = "008kmjsvanh6qgnpvsn3qacfcyprxirxbw4yfd8flyg7mxw793ws";
33+ src = fetchPypi {
34+ inherit pname version;
35+ sha256 = "0xia81wvfrhyriywab184s49g8rpl42vcf5fy3x6xxw50a2yn7cs";
4936 };
5037
5138 propagatedBuildInputs = [
5239 cython
5340 cymem
41+ msgpack-numpy
42+ msgpack-python
5443 preshed
5544 numpy
5645 murmurhash
@@ -64,22 +53,34 @@ in buildPythonPackage rec {
6453 termcolor
6554 wrapt
6655 dill
67− pathlibLocked
56+ ] ++ lib.optional (pythonOlder "3.4") pathlib;
57+
58+
59+ checkInputs = [
60+ pytest
6861 ];
6962
63+ prePatch = ''
64+ substituteInPlace setup.py --replace \
65+ "'pathlib>=1.0.0,<2.0.0'," \
66+ "\"pathlib>=1.0.0,<2.0.0; python_version<'3.4'\","
67+
68+ substituteInPlace setup.py --replace \
69+ "'cytoolz>=0.8,<0.9'," \
70+ "'cytoolz>=0.8',"
71+ '';
72+
73+ # Cannot find cython modules.
7074 doCheck = false;
7175
72− # fails to import some modules
73− # checkPhase = ''
74− # ${python.interpreter} -m pytest thinc/tests
75− # # cd thinc/tests
76− # # ${python.interpreter} -m unittest discover -p "*test*"
77− # '';
76+ checkPhase = ''
77+ pytest thinc/tests
78+ '';
7879
7980 meta = with stdenv.lib; {
8081 description = "Practical Machine Learning for NLP in Python";
8182 homepage = https://github.com/explosion/thinc;
8283 license = licenses.mit;
83− maintainers = with maintainers; [ sdll ];
84+ maintainers = with maintainers; [ aborsu sdll ];
8485 };
8586}
pkgs/top-level/python-packages.nix+2
@@ -10138,6 +10138,8 @@ in {
1013810138
1013910139 msgpack = callPackage ../development/python-modules/msgpack {};
1014010140
10141+ msgpack-numpy = callPackage ../development/python-modules/msgpack-numpy {};
10142+
1014110143 msgpack-python = self.msgpack.overridePythonAttrs {
1014210144 pname = "msgpack-python";
1014310145 postPatch = ''