about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/matplotx/default.nix
blob: 77643ece548dfefb3a408abc5f86bcaddfa0ea21 (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
64
65
66
67
68
{ lib
, stdenv
, buildPythonPackage
, fetchFromGitHub
, pytestCheckHook
, setuptools
, matplotlib
, numpy
, networkx
, pypng
, scipy
}:

buildPythonPackage rec {
  pname = "matplotx";
  version = "0.3.10";
  format = "pyproject";

  src = fetchFromGitHub {
    owner = "nschloe";
    repo = "matplotx";
    rev = "v${version}";
    hash = "sha256-EWEiEY23uFwd/vgWVLCH/buUmgRqz1rqqlJEdXINYMg=";
  };

  propagatedBuildInputs = [
    setuptools
    matplotlib
    numpy
  ];

  passthru.optional-dependencies = {
    all = [
      networkx
      pypng
      scipy
    ];
    contour = [ networkx ];
    spy = [
      pypng
      scipy
    ];
  };

  # 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
  ] ++ passthru.optional-dependencies.all;

  disabledTestPaths = [
    "tests/test_spy.py" # Requires meshzoo (non-free) and pytest-codeblocks (not packaged)
  ];

  pythonImportsCheck = [ "matplotx" ];

  meta = {
    homepage = "https://github.com/nschloe/matplotx";
    description = "More styles and useful extensions for Matplotlib";
    mainProgram = "matplotx";
    changelog = "https://github.com/nschloe/matplotx/releases/tag/v${version}";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ swflint ];
  };
}