summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/datatable/default.nix
blob: 66b5a814ae43918fbe2a83221ea7126fedcc5791 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
{
  lib,
  stdenv,
  buildPythonPackage,
  fetchFromGitHub,
  pipInstallHook,
  pythonAtLeast,
  blessed,
  docutils,
  llvm,
  pytestCheckHook,
  typesentry,
}:

buildPythonPackage rec {
  pname = "datatable";
  version = "1.1.0";
  pyproject = true;

  disabled = pythonAtLeast "3.13";

  src = fetchFromGitHub {
    owner = "h2oai";
    repo = "datatable";
    tag = "v${version}";
    hash = "sha256-U6FYqjbVed/Qsxj/8bgwRd2UlK0dq/i61Fg56Br+lzs=";
  };

  postPatch = ''
    # tarball doesn't appear to have been shipped totally ready-to-build
    substituteInPlace ci/ext.py \
      --replace-fail \
        'shell_cmd(["git"' \
        '"0000000000000000000000000000000000000000" or shell_cmd(["git"'
    echo '${version}' > VERSION.txt

    # don't make assumptions about architecture
    substituteInPlace ci/ext.py \
      --replace-fail \
        'ext.compiler.add_linker_flag("-m64")' \
        'pass  # removed -m64 flag assumption'

    # Fix flatbuffers span const member assignment issue
    # Remove const from member variables to allow assignment operator to work
    substituteInPlace src/core/lib/flatbuffers/stl_emulation.h \
      --replace-fail \
        'pointer const data_;' \
        'pointer data_;' \
      --replace-fail \
        'const size_type count_;' \
        'size_type count_;'
  '';
  DT_RELEASE = "1";

  propagatedBuildInputs = [
    typesentry
    blessed
  ];
  buildInputs = [
    llvm
    pipInstallHook
  ];
  nativeCheckInputs = [
    docutils
    pytestCheckHook
  ];

  LLVM = llvm;
  env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-isystem ${lib.getInclude stdenv.cc.libcxx}/include/c++/v1";

  # test suite is very cpu intensive, only run small subset to ensure package is working as expected
  enabledTestPaths = [ "tests/test-sets.py" ];

  disabledTests = [
    # skip tests which are irrelevant to our installation or use way too much memory
    "test_xfunction_paths"
    "test_fread_from_cmd2"
    "test_cast_huge_to_str"
    "test_create_large_string_column"
  ];
  pythonImportsCheck = [ "datatable" ];

  meta = {
    description = "data.table for Python";
    homepage = "https://github.com/h2oai/datatable";
    license = lib.licenses.mpl20;
    maintainers = [ ];
  };
}