summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/mpl-scatter-density/default.nix
blob: e3eaff5aee6290fee645f023b9f15d9b1e0723cd (plain)
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
64
65
{
  lib,
  stdenv,
  buildPythonPackage,
  pytestCheckHook,
  fetchFromGitHub,
  setuptools-scm,
  setuptools,
  fast-histogram,
  matplotlib,
  numpy,
  wheel,
  pytest-mpl,
  writableTmpDirAsHomeHook,
}:

buildPythonPackage rec {
  pname = "mpl-scatter-density";
  version = "0.8";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "astrofrog";
    repo = "mpl-scatter-density";
    tag = "v${version}";
    hash = "sha256-pDiKJAN/4WFf5icNU/ZGOvw0jqN3eGZHgilm2oolpbE=";
  };

  build-system = [
    setuptools
    setuptools-scm
    wheel
  ];

  dependencies = [
    matplotlib
    numpy
    fast-histogram
  ];

  nativeCheckInputs = [
    pytestCheckHook
    pytest-mpl
    writableTmpDirAsHomeHook
  ];

  # Need to set MPLBACKEND=agg for headless `matplotlib` on darwin.
  # https://github.com/matplotlib/matplotlib/issues/26292
  env.MPLBACKEND = lib.optionalString stdenv.hostPlatform.isDarwin "agg";

  disabledTests = [
    # AssertionError: (240, 240) != (216, 216)
    # Erroneous pinning of figure DPI, sensitive to runtime environment
    "test_default_dpi"
  ];

  pythonImportsCheck = [ "mpl_scatter_density" ];

  meta = {
    homepage = "https://github.com/astrofrog/mpl-scatter-density";
    description = "Fast scatter density plots for Matplotlib";
    license = lib.licenses.bsd2;
    maintainers = with lib.maintainers; [ ifurther ];
  };
}