1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchPypi,
6 setuptools-scm,
7 demes,
8 matplotlib,
9 numpy,
10 scipy,
11 pythonOlder,
12 pytestCheckHook,
13 pytest-xdist,
14 mpmath,
15}:
16
17buildPythonPackage rec {
18 pname = "demesdraw";
19 version = "0.4.0";
20 format = "pyproject";
21 disabled = pythonOlder "3.7";
22
23 src = fetchPypi {
24 inherit pname version;
25 hash = "sha256-n7dz+kYf2yyr66TBx452W6z4qT6bT81u0J4aMAYuGCc=";
26 };
27
28 nativeBuildInputs = [ setuptools-scm ];
29
30 propagatedBuildInputs = [
31 demes
32 matplotlib
33 numpy
34 scipy
35 ];
36
37 postPatch = ''
38 # remove coverage arguments to pytest
39 sed -i '/--cov/d' setup.cfg
40 '';
41
42 # This variable is needed to suppress the "Trace/BPT trap: 5" error in Darwin's checkPhase.
43 # Not sure of the details, but we can avoid it by changing the matplotlib backend during testing.
44 env.MPLBACKEND = lib.optionalString stdenv.isDarwin "Agg";
45
46 nativeCheckInputs = [
47 pytestCheckHook
48 pytest-xdist
49 mpmath
50 ];
51
52 pythonImportsCheck = [ "demesdraw" ];
53
54 meta = with lib; {
55 description = "Drawing functions for Demes demographic models";
56 mainProgram = "demesdraw";
57 homepage = "https://github.com/grahamgower/demesdraw";
58 license = licenses.isc;
59 maintainers = with maintainers; [ alxsimon ];
60 };
61}