Skip to content

Commit 6a4e785

Browse files
wkralJon
authored and
Jon
committed
python3Packages.word2vec: fix build and tests
1 parent 5f0f2b8 commit 6a4e785

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

pkgs/development/python-modules/word2vec/default.nix

+22-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,23 @@
11
{ stdenv
22
, buildPythonPackage
33
, fetchPypi
4+
, fetchzip
45
, cython
56
, numpy
67
, scikitlearn
78
, six
8-
, python
9+
, setuptools_scm
10+
, gcc
11+
, pytest
12+
, pytestcov
913
, isPy27
1014
}:
11-
15+
let
16+
testData = fetchzip {
17+
url = "http://mattmahoney.net/dc/text8.zip";
18+
sha256 = "0w3l64bww9znmmvd9cqbfmh3dddnlrjicz43y5qq6fhi9cfqjfar";
19+
};
20+
in
1221
buildPythonPackage rec {
1322
pname = "word2vec";
1423
version = "0.11.1";
@@ -19,17 +28,25 @@ buildPythonPackage rec {
1928
sha256 = "222d8ffb47f385c43eba45e3f308e605fc9736b2b7137d74979adf1a31e7c8b4";
2029
};
2130

31+
nativeBuildInputs = [ setuptools_scm gcc ];
32+
2233
propagatedBuildInputs = [ cython numpy scikitlearn six ];
2334

35+
checkInputs = [ pytest pytestcov ];
36+
37+
# Checks require test data downloaded separately
38+
# See project source Makefile:test-data rule for reference
2439
checkPhase = ''
25-
cd word2vec/tests;
26-
${python.interpreter} test_word2vec.py
40+
PATH=$PATH:$out/bin
41+
mkdir data
42+
head -c 100000 ${testData}/text8 > data/text8-small
43+
pytest
2744
'';
2845

2946
meta = with stdenv.lib; {
3047
description = "Tool for computing continuous distributed representations of words";
3148
homepage = "https://github.com/danielfrg/word2vec";
32-
license = licenses.asl20;
49+
license = licenses.asl20;
3350
maintainers = with maintainers; [ NikolaMandic ];
3451
};
3552

0 commit comments

Comments
 (0)