about summary refs log tree commit diff
path: root/pkgs/development/python-modules/demesdraw/default.nix
blob: 42e9fdc4c5f97af4e4e9775aed4b924a0b998d25 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{ lib
, stdenv
, buildPythonPackage
, fetchPypi
, setuptools-scm
, demes
, matplotlib
, numpy
, scipy
, pythonOlder
, pytestCheckHook
, pytest-xdist
, mpmath
}:

buildPythonPackage rec {
  pname = "demesdraw";
  version = "0.4.0";
  format = "pyproject";
  disabled = pythonOlder "3.7";

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-n7dz+kYf2yyr66TBx452W6z4qT6bT81u0J4aMAYuGCc=";
  };

  nativeBuildInputs = [
    setuptools-scm
  ];

  propagatedBuildInputs = [
    demes
    matplotlib
    numpy
    scipy
  ];

  postPatch = ''
    # remove coverage arguments to pytest
    sed -i '/--cov/d' setup.cfg
  '';

  # This variable is needed to suppress the "Trace/BPT trap: 5" error in Darwin's checkPhase.
  # Not sure of the details, but we can avoid it by changing the matplotlib backend during testing.
  env.MPLBACKEND = lib.optionalString stdenv.isDarwin "Agg";

  nativeCheckInputs = [
    pytestCheckHook
    pytest-xdist
    mpmath
  ];

  pythonImportsCheck = [
    "demesdraw"
  ];

  meta = with lib; {
    description = "Drawing functions for Demes demographic models";
    homepage = "https://github.com/grahamgower/demesdraw";
    license = licenses.isc;
    maintainers = with maintainers; [ alxsimon ];
  };
}