nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 cython,
8 setuptools,
9
10 # dependencies
11 numpy,
12 scipy,
13 smart-open,
14
15 # tests
16 mock,
17 pyemd,
18 pytestCheckHook,
19 testfixtures,
20}:
21
22buildPythonPackage rec {
23 pname = "gensim";
24 version = "4.4.0";
25 pyproject = true;
26
27 src = fetchFromGitHub {
28 owner = "piskvorky";
29 repo = "gensim";
30 tag = version;
31 hash = "sha256-TXutcU43ReBj9ss9+zBJFUxb5JqVHpl+B0c7hqcJAJY=";
32 };
33
34 build-system = [
35 cython
36 setuptools
37 ];
38
39 dependencies = [
40 numpy
41 scipy
42 smart-open
43 ];
44
45 nativeCheckInputs = [
46 mock
47 pyemd
48 pytestCheckHook
49 testfixtures
50 ];
51
52 pythonImportsCheck = [ "gensim" ];
53
54 enabledTestPaths = [ "gensim/test" ];
55
56 # test_parallel is flaky under load
57 disabledTests = [ "test_parallel" ];
58
59 preCheck = ''
60 export GENSIM_DATA_DIR="$NIX_BUILD_TOP/gensim-data"
61 mkdir -p "$GENSIM_DATA_DIR"
62 export SKIP_NETWORK_TESTS=1
63 ''
64 # Prevent python from importing gensim from the source files during tests
65 + ''
66 rm gensim/__init__.py
67 '';
68
69 meta = {
70 description = "Topic-modelling library";
71 homepage = "https://radimrehurek.com/gensim/";
72 downloadPage = "https://github.com/piskvorky/gensim";
73 changelog = "https://github.com/RaRe-Technologies/gensim/blob/${version}/CHANGELOG.md";
74 license = lib.licenses.lgpl21Only;
75 };
76}