summaryrefslogtreecommitdiffstats
path: root/pkgs/development/python-modules/biom-format/default.nix
blob: 6199173498820ee4b1570df1eaf11b0da8d39a7f (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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,

  # build-system
  cython,
  numpy,
  setuptools,

  # dependencies
  click,
  h5py,
  pandas,
  scipy,

  # tests
  pytestCheckHook,
}:

buildPythonPackage (finalAttrs: {
  pname = "biom-format";
  version = "2.1.17";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "biocore";
    repo = "biom-format";
    tag = finalAttrs.version;
    hash = "sha256-FjIC21LoqltixBstbbANByjTNxVm/3YCxdWaD9KbOQ0=";
  };

  # https://numpy.org/doc/stable//release/2.4.0-notes.html#removed-numpy-in1d
  postPatch = ''
    substituteInPlace biom/table.py \
      --replace-fail "np.in1d" "np.isin"
  '';

  build-system = [
    cython
    numpy
    setuptools
  ];

  dependencies = [
    click
    h5py
    numpy
    pandas
    scipy
  ];

  # make pytest resolve the package from $out
  # some tests don't work if we change the level of directory nesting
  preCheck = ''
    mkdir biom_tests
    mv biom/tests biom_tests/tests
    rm -r biom
  '';

  nativeCheckInputs = [ pytestCheckHook ];

  enabledTestPaths = [ "biom_tests/tests" ];

  pythonImportsCheck = [ "biom" ];

  meta = {
    description = "Biological Observation Matrix (BIOM) format";
    homepage = "http://biom-format.org/";
    downloadPage = "https://github.com/biocore/biom-format";
    changelog = "https://github.com/biocore/biom-format/blob/${finalAttrs.src.tag}/ChangeLog.md";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ tomasajt ];
  };
})