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