1{
2 lib,
3 buildPythonPackage,
4 demes,
5 fetchPypi,
6 gsl,
7 newick,
8 numpy,
9 oldest-supported-numpy,
10 pytest-xdist,
11 pytestCheckHook,
12 pythonOlder,
13 scipy,
14 setuptools-scm,
15 tskit,
16 wheel,
17}:
18
19buildPythonPackage rec {
20 pname = "msprime";
21 version = "1.3.4";
22 pyproject = true;
23
24 disabled = pythonOlder "3.8";
25
26 src = fetchPypi {
27 inherit pname version;
28 hash = "sha256-0PlEo3pREx34zZZ5fyR5gXPEC6L/XAlFgdHKVvxRFzA=";
29 };
30
31 postPatch = ''
32 # build-time constriant, used to ensure forward and backward compat
33 substituteInPlace pyproject.toml \
34 --replace-fail "numpy>=2" "numpy"
35 '';
36
37 nativeBuildInputs = [
38 gsl
39 oldest-supported-numpy
40 setuptools-scm
41 wheel
42 ];
43
44 buildInputs = [ gsl ];
45
46 propagatedBuildInputs = [
47 numpy
48 newick
49 tskit
50 demes
51 ];
52
53 nativeCheckInputs = [
54 pytestCheckHook
55 pytest-xdist
56 scipy
57 ];
58
59 disabledTests = [
60 "tests/test_ancestry.py::TestSimulator::test_debug_logging"
61 "tests/test_ancestry.py::TestSimulator::test_debug_logging_dtw"
62 ];
63
64 disabledTestPaths = [
65 "tests/test_demography.py"
66 "tests/test_algorithms.py"
67 "tests/test_provenance.py"
68 "tests/test_dict_encoding.py"
69 ];
70
71 # `python -m pytest` puts $PWD in sys.path, which causes the extension
72 # modules imported as `msprime._msprime` to be unavailable, failing the
73 # tests. This deletes the `msprime` folder such that only what's installed in
74 # $out is used for the imports. See also discussion at:
75 # https://github.com/NixOS/nixpkgs/issues/255262
76 preCheck = ''
77 rm -r msprime
78 '';
79 pythonImportsCheck = [ "msprime" ];
80
81 meta = with lib; {
82 description = "Simulate genealogical trees and genomic sequence data using population genetic models";
83 homepage = "https://github.com/tskit-dev/msprime";
84 changelog = "https://github.com/tskit-dev/msprime/blob/${version}/CHANGELOG.md";
85 license = licenses.gpl3Plus;
86 maintainers = with maintainers; [ ];
87 };
88}