about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/msprime/default.nix
blob: 2ec32c255dfa221cccf1f1a7f44f54f99e1957f8 (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
{ lib
, buildPythonPackage
, fetchPypi
, fetchpatch
, oldest-supported-numpy
, setuptools-scm
, wheel
, pythonOlder
, gsl
, numpy
, newick
, tskit
, demes
, pytestCheckHook
, pytest-xdist
, scipy
}:

buildPythonPackage rec {
  pname = "msprime";
  version = "1.2.0";
  format = "pyproject";
  disabled = pythonOlder "3.8";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-YAJa2f0w2CenKubnYLbP8HodDhabLB2hAkyw/CPkp6o=";
  };

  patches = [
    # upstream patch fixes 2 failing unittests. remove on update
    (fetchpatch {
      name = "python311.patch";
      url = "https://github.com/tskit-dev/msprime/commit/639125ec942cb898cf4a80638f229e11ce393fbc.patch";
      hash = "sha256-peli4tdu8Bv21xIa5H8SRdfjQnTMO72IPFqybmSBSO8=";
      includes = [ "tests/test_ancestry.py" ];
    })
  ];

  nativeBuildInputs = [
    gsl
    oldest-supported-numpy
    setuptools-scm
    wheel
  ];

  buildInputs = [
    gsl
  ];

  propagatedBuildInputs = [
    numpy
    newick
    tskit
    demes
  ];

  nativeCheckInputs = [
    pytestCheckHook
    pytest-xdist
    scipy
  ];
  disabledTests = [
    "tests/test_ancestry.py::TestSimulator::test_debug_logging"
    "tests/test_ancestry.py::TestSimulator::test_debug_logging_dtw"
  ];
  disabledTestPaths = [
    "tests/test_demography.py"
    "tests/test_algorithms.py"
    "tests/test_provenance.py"
    "tests/test_dict_encoding.py"
  ];

  # `python -m pytest` puts $PWD in sys.path, which causes the extension
  # modules imported as `msprime._msprime` to be unavailable, failing the
  # tests. This deletes the `msprime` folder such that only what's installed in
  # $out is used for the imports. See also discussion at:
  # https://github.com/NixOS/nixpkgs/issues/255262
  preCheck = ''
    rm -r msprime
  '';
  pythonImportsCheck = [
    "msprime"
  ];

  meta = with lib; {
    description = "Simulate genealogical trees and genomic sequence data using population genetic models";
    homepage = "https://github.com/tskit-dev/msprime";
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [ alxsimon ];
  };
}