about summary refs log tree commit diff
path: root/pkgs/development/python-modules/phik/default.nix
blob: b2dae6f29b1eee06a8d1019e168b19bc1ccc9d2b (plain) (blame)
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
90
91
92
93
94
95
96
97
98
99
{ lib
, buildPythonPackage
, cmake
, fetchFromGitHub
, joblib
, jupyter
, jupyter-client
, matplotlib
, nbconvert
, ninja
, numba
, numpy
, pandas
, pybind11
, pytestCheckHook
, pythonOlder
, scikit-build
, scipy
, setuptools
}:

buildPythonPackage rec {
  pname = "phik";
  version = "0.12.4";
  pyproject = true;

  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "KaveIO";
    repo = "PhiK";
    rev = "refs/tags/v${version}";
    hash = "sha256-YsH7vVn6gzejunUjUY/RIcvWtaQ/W1gbciJWKi5LDTk=";
  };

  nativeBuildInputs = [
    cmake
    ninja
    scikit-build
    setuptools
  ];

  propagatedBuildInputs = [
    joblib
    numpy
    scipy
    pandas
    matplotlib
    numba
    pybind11
  ];

  nativeCheckInputs = [
    pytestCheckHook
    nbconvert
    jupyter
    jupyter-client
  ];

  # Uses setuptools to drive build process
  dontUseCmakeConfigure = true;

  pythonImportsCheck = [
    "phik"
  ];

  postInstall = ''
    rm -r $out/bin
  '';

  preCheck = ''
    # import from $out
    rm -r phik
  '';

  disabledTests = [
    # TypeError: 'numpy.float64' object cannot be interpreted as an integer
    # https://github.com/KaveIO/PhiK/issues/73
    "test_significance_matrix_hybrid"
    "test_significance_matrix_mc"
  ];

  disabledTestPaths = [
    # Don't test integrations
    "tests/phik_python/integration/"
  ];

  meta = with lib; {
    description = "Phi_K correlation analyzer library";
    longDescription = ''
      Phi_K is a new and practical correlation coefficient based on several refinements to
      Pearson’s hypothesis test of independence of two variables.
    '';
    homepage = "https://phik.readthedocs.io/";
    changelog = "https://github.com/KaveIO/PhiK/blob/${version}/CHANGES.rst";
    license = licenses.asl20;
    maintainers = with maintainers; [ melsigl ];
  };
}