Merge pull request #36899 from aborsu/spacy

Spacy
This commit is contained in:
Robert Schütz 2018-03-14 23:36:46 +01:00 committed by GitHub
commit d78a411d98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 137 additions and 75 deletions

View File

@ -176,6 +176,11 @@
github = "abigailbuccaneer"; github = "abigailbuccaneer";
name = "Abigail Bunyan"; name = "Abigail Bunyan";
}; };
aborsu = {
email = "a.borsu@gmail.com";
github = "aborsu";
name = "Augustin Borsu";
};
aboseley = { aboseley = {
email = "adam.boseley@gmail.com"; email = "adam.boseley@gmail.com";
github = "aboseley"; github = "aboseley";

View File

@ -7,18 +7,23 @@
, python , python
, isPy3k , isPy3k
}: }:
buildPythonPackage rec { buildPythonPackage rec {
name = "${pname}-${version}";
pname = "ftfy"; pname = "ftfy";
# latest is 5.1.1, buy spaCy requires 4.4.3
version = "5.3.0"; version = "4.4.3";
# ftfy v5 only supports python3. Since at the moment the only
# packages that use ftfy are spacy and textacy which both support
# python 2 and 3, they have pinned ftfy to the v4 branch.
# I propose to stick to v4 until another package requires v5.
# At that point we can make a ftfy_v4 package.
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;
sha256 = "0ba702d5138f9b35df32b55920c9466208608108f1f3d5de1a68c17e3d68cb7f"; sha256 = "152xdb56rhs1q4r0ck1n557sbphw7zq18r75a7kkd159ckdnc01w";
}; };
propagatedBuildInputs = [ html5lib wcwidth]; propagatedBuildInputs = [ html5lib wcwidth ];
checkInputs = [ checkInputs = [
nose nose
@ -32,13 +37,10 @@ buildPythonPackage rec {
# FileNotFoundError: [Errno 2] No such file or directory: 'ftfy' # FileNotFoundError: [Errno 2] No such file or directory: 'ftfy'
doCheck = false; doCheck = false;
# "this version of ftfy is no longer written for Python 2"
disabled = !isPy3k;
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Given Unicode text, make its representation consistent and possibly less broken."; description = "Given Unicode text, make its representation consistent and possibly less broken.";
homepage = https://github.com/LuminosoInsight/python-ftfy/tree/master/tests; homepage = https://github.com/LuminosoInsight/python-ftfy/tree/master/tests;
license = licenses.mit; license = licenses.mit;
maintainers = with maintainers; [ sdll ]; maintainers = with maintainers; [ sdll aborsu ];
}; };
} }

View File

@ -0,0 +1,38 @@
{ stdenv
, buildPythonPackage
, fetchPypi
, cython
, msgpack-python
, numpy
, python
}:
buildPythonPackage rec {
pname = "msgpack-numpy";
version = "0.4.1";
src = fetchPypi {
inherit pname version;
sha256 = "1czf125nixzwskiqiw0145kfj15030sp334cb89gp5w4rz3h7img";
};
buildInputs = [
cython
];
propagatedBuildInputs = [
msgpack-python
numpy
];
checkPhase = ''
${python.interpreter} msgpack_numpy.py
'';
meta = with stdenv.lib; {
description = "Practical Machine Learning for NLP in Python";
homepage = https://github.com/lebedov/msgpack-numpy;
license = licenses.bsd3;
maintainers = with maintainers; [ aborsu ];
};
}

View File

@ -1,35 +1,34 @@
{ stdenv { stdenv
, buildPythonPackage , buildPythonPackage
, fetchFromGitHub , fetchPypi
, cython , cython
, python , python
}: }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "murmurhash"; pname = "murmurhash";
version = "0.26.4"; version = "0.28.0";
name = pname + "-" + version;
src = fetchFromGitHub { src = fetchPypi {
owner = "explosion"; inherit pname version;
repo = "murmurhash"; sha256 = "16id8jppw8r54wisrlaaiprcszzb7d7lbpnskqn38s8i7vnkf4b5";
rev = "0.26.4";
sha256 = "0n2j0glhlv2yh3fjgbg4d79j1c1fpchgjd4vnpw908l9mzchhmdv";
}; };
buildInputs = [ buildInputs = [
cython cython
]; ];
# No test
doCheck = false;
checkPhase = '' checkPhase = ''
cd murmurhash/tests pytest murmurhash
${python.interpreter} -m unittest discover -p "*test*"
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Cython bindings for MurmurHash2"; description = "Cython bindings for MurmurHash2";
homepage = https://github.com/explosion/murmurhash; homepage = https://github.com/explosion/murmurhash;
license = licenses.mit; license = licenses.mit;
maintainers = with maintainers; [ sdll ]; maintainers = with maintainers; [ aborsu sdll ];
}; };
} }

View File

@ -3,12 +3,11 @@
, buildPythonPackage , buildPythonPackage
, python , python
, fetchPypi , fetchPypi
, fetchFromGitHub , html5lib
, pytest , pytest
, cython , cython
, cymem
, preshed , preshed
, pathlib2 , ftfy
, numpy , numpy
, murmurhash , murmurhash
, plac , plac
@ -16,7 +15,6 @@
, ujson , ujson
, dill , dill
, requests , requests
, ftfy
, thinc , thinc
, pip , pip
, regex , regex
@ -24,32 +22,49 @@
buildPythonPackage rec { buildPythonPackage rec {
pname = "spacy"; pname = "spacy";
version = "1.8.2"; version = "2.0.9";
src = fetchFromGitHub { src = fetchPypi {
owner = "explosion"; inherit pname version;
repo = "spaCy"; sha256 = "1ihkhflhyz67bp73kfjqfrbcgdxi2msz5asbrh0pkk590c4vmms5";
rev = "v${version}";
sha256 = "0v3bmmar31a6968y4wl0lmgnc3829l2mnwd8s959m4pqw1y1w648";
}; };
prePatch = ''
substituteInPlace setup.py --replace \
"'html5lib==1.0b8'," \
"'html5lib',"
substituteInPlace setup.py --replace \
"'regex==2017.4.5'," \
"'regex',"
substituteInPlace setup.py --replace \
"'ftfy==2017.4.5'," \
"'ftfy',"
substituteInPlace setup.py --replace \
"'pathlib'," \
"\"pathlib; python_version<'3.4'\","
'';
propagatedBuildInputs = [ propagatedBuildInputs = [
cython cython
cymem
pathlib2
preshed
numpy
murmurhash
plac
six
ujson
dill dill
requests html5lib
murmurhash
numpy
plac
preshed
regex regex
ftfy requests
six
thinc thinc
pytest ujson
pip ftfy
];
checkInputs = [
pytest
]; ];
doCheck = false; doCheck = false;

View File

@ -1,15 +1,19 @@
{ stdenv { stdenv
, lib
, pkgs , pkgs
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, fetchFromGitHub , pythonOlder
, pytest , pytest
, cython , cython
, cymem , cymem
, msgpack-numpy
, msgpack-python
, preshed , preshed
, numpy , numpy
, python , python
, murmurhash , murmurhash
, pathlib
, hypothesis , hypothesis
, tqdm , tqdm
, cytoolz , cytoolz
@ -21,36 +25,21 @@
, dill , dill
}: }:
let buildPythonPackage rec {
enableDebugging = true;
pathlibLocked = buildPythonPackage rec {
name = "${pname}-${version}";
pname = "pathlib";
version = "1.0.1";
src = fetchPypi {
inherit pname version;
sha256 = "17zajiw4mjbkkv6ahp3xf025qglkj0805m9s41c45zryzj6p2h39";
};
doCheck = false; # fails to import support from test
};
in buildPythonPackage rec {
pname = "thinc"; pname = "thinc";
version = "6.5.1"; version = "6.10.2";
name = pname + "-" + version; name = pname + "-" + version;
src = fetchFromGitHub { src = fetchPypi {
owner = "explosion"; inherit pname version;
repo = "thinc"; sha256 = "0xia81wvfrhyriywab184s49g8rpl42vcf5fy3x6xxw50a2yn7cs";
rev = "v${version}";
sha256 = "008kmjsvanh6qgnpvsn3qacfcyprxirxbw4yfd8flyg7mxw793ws";
}; };
propagatedBuildInputs = [ propagatedBuildInputs = [
cython cython
cymem cymem
msgpack-numpy
msgpack-python
preshed preshed
numpy numpy
murmurhash murmurhash
@ -64,22 +53,34 @@ in buildPythonPackage rec {
termcolor termcolor
wrapt wrapt
dill dill
pathlibLocked ] ++ lib.optional (pythonOlder "3.4") pathlib;
checkInputs = [
pytest
]; ];
prePatch = ''
substituteInPlace setup.py --replace \
"'pathlib>=1.0.0,<2.0.0'," \
"\"pathlib>=1.0.0,<2.0.0; python_version<'3.4'\","
substituteInPlace setup.py --replace \
"'cytoolz>=0.8,<0.9'," \
"'cytoolz>=0.8',"
'';
# Cannot find cython modules.
doCheck = false; doCheck = false;
# fails to import some modules checkPhase = ''
# checkPhase = '' pytest thinc/tests
# ${python.interpreter} -m pytest thinc/tests '';
# # cd thinc/tests
# # ${python.interpreter} -m unittest discover -p "*test*"
# '';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "Practical Machine Learning for NLP in Python"; description = "Practical Machine Learning for NLP in Python";
homepage = https://github.com/explosion/thinc; homepage = https://github.com/explosion/thinc;
license = licenses.mit; license = licenses.mit;
maintainers = with maintainers; [ sdll ]; maintainers = with maintainers; [ aborsu sdll ];
}; };
} }

View File

@ -10138,6 +10138,8 @@ in {
msgpack = callPackage ../development/python-modules/msgpack {}; msgpack = callPackage ../development/python-modules/msgpack {};
msgpack-numpy = callPackage ../development/python-modules/msgpack-numpy {};
msgpack-python = self.msgpack.overridePythonAttrs { msgpack-python = self.msgpack.overridePythonAttrs {
pname = "msgpack-python"; pname = "msgpack-python";
postPatch = '' postPatch = ''