summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/gensim/default.nix
blob: 4cf38bdb3d0aaa68d95294f5db0816bc56dd389e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  cython,
  setuptools,

  # dependencies
  numpy,
  scipy,
  smart-open,

  # tests
  mock,
  pyemd,
  pytestCheckHook,
  testfixtures,
}:

buildPythonPackage rec {
  pname = "gensim";
  version = "4.4.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "piskvorky";
    repo = "gensim";
    tag = version;
    hash = "sha256-TXutcU43ReBj9ss9+zBJFUxb5JqVHpl+B0c7hqcJAJY=";
  };

  build-system = [
    cython
    setuptools
  ];

  dependencies = [
    numpy
    scipy
    smart-open
  ];

  nativeCheckInputs = [
    mock
    pyemd
    pytestCheckHook
    testfixtures
  ];

  pythonImportsCheck = [ "gensim" ];

  enabledTestPaths = [ "gensim/test" ];

  # test_parallel is flaky under load
  disabledTests = [ "test_parallel" ];

  preCheck = ''
    export GENSIM_DATA_DIR="$NIX_BUILD_TOP/gensim-data"
    mkdir -p "$GENSIM_DATA_DIR"
    export SKIP_NETWORK_TESTS=1
  ''
  # Prevent python from importing gensim from the source files during tests
  + ''
    rm gensim/__init__.py
  '';

  meta = {
    description = "Topic-modelling library";
    homepage = "https://radimrehurek.com/gensim/";
    downloadPage = "https://github.com/piskvorky/gensim";
    changelog = "https://github.com/RaRe-Technologies/gensim/blob/${version}/CHANGELOG.md";
    license = lib.licenses.lgpl21Only;
  };
}