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.1";
22 pyproject = true;
23
24 disabled = pythonOlder "3.8";
25
26 src = fetchPypi {
27 inherit pname version;
28 hash = "sha256-s/Ys1RatLkPIQS6h8kKsrRvJOTkc/pyqGWJYdOLjSDU=";
29 };
30
31 nativeBuildInputs = [
32 gsl
33 oldest-supported-numpy
34 setuptools-scm
35 wheel
36 ];
37
38 buildInputs = [ gsl ];
39
40 propagatedBuildInputs = [
41 numpy
42 newick
43 tskit
44 demes
45 ];
46
47 nativeCheckInputs = [
48 pytestCheckHook
49 pytest-xdist
50 scipy
51 ];
52
53 disabledTests = [
54 "tests/test_ancestry.py::TestSimulator::test_debug_logging"
55 "tests/test_ancestry.py::TestSimulator::test_debug_logging_dtw"
56 ];
57
58 disabledTestPaths = [
59 "tests/test_demography.py"
60 "tests/test_algorithms.py"
61 "tests/test_provenance.py"
62 "tests/test_dict_encoding.py"
63 ];
64
65 # `python -m pytest` puts $PWD in sys.path, which causes the extension
66 # modules imported as `msprime._msprime` to be unavailable, failing the
67 # tests. This deletes the `msprime` folder such that only what's installed in
68 # $out is used for the imports. See also discussion at:
69 # https://github.com/NixOS/nixpkgs/issues/255262
70 preCheck = ''
71 rm -r msprime
72 '';
73 pythonImportsCheck = [ "msprime" ];
74
75 meta = with lib; {
76 description = "Simulate genealogical trees and genomic sequence data using population genetic models";
77 homepage = "https://github.com/tskit-dev/msprime";
78 changelog = "https://github.com/tskit-dev/msprime/blob/${version}/CHANGELOG.md";
79 license = licenses.gpl3Plus;
80 maintainers = with maintainers; [ alxsimon ];
81 };
82}