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