1{ lib
2, stdenv
3, buildPythonPackage
4, fetchFromGitHub
5, pytestCheckHook
6, setuptools
7, matplotlib
8, numpy
9, networkx
10, pypng
11, scipy
12}:
13
14buildPythonPackage rec {
15 pname = "matplotx";
16 version = "0.3.10";
17 format = "pyproject";
18
19 src = fetchFromGitHub {
20 owner = "nschloe";
21 repo = "matplotx";
22 rev = "v${version}";
23 hash = "sha256-EWEiEY23uFwd/vgWVLCH/buUmgRqz1rqqlJEdXINYMg=";
24 };
25
26 propagatedBuildInputs = [
27 setuptools
28 matplotlib
29 numpy
30 ];
31
32 passthru.optional-dependencies = {
33 all = [
34 networkx
35 pypng
36 scipy
37 ];
38 contour = [ networkx ];
39 spy = [
40 pypng
41 scipy
42 ];
43 };
44
45 # This variable is needed to suppress the "Trace/BPT trap: 5" error in Darwin's checkPhase.
46 # Not sure of the details, but we can avoid it by changing the matplotlib backend during testing.
47 env.MPLBACKEND = lib.optionalString stdenv.isDarwin "Agg";
48
49 nativeCheckInputs = [
50 pytestCheckHook
51 ] ++ passthru.optional-dependencies.all;
52
53 disabledTestPaths = [
54 "tests/test_spy.py" # Requires meshzoo (non-free) and pytest-codeblocks (not packaged)
55 ];
56
57 pythonImportsCheck = [ "matplotx" ];
58
59 meta = {
60 homepage = "https://github.com/nschloe/matplotx";
61 description = "More styles and useful extensions for Matplotlib";
62 changelog = "https://github.com/nschloe/matplotx/releases/tag/v${version}";
63 license = lib.licenses.mit;
64 maintainers = with lib.maintainers; [ swflint ];
65 };
66}
67