1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 fetchpatch2,
7 flit-core,
8 matplotlib,
9 pytest-xdist,
10 pytestCheckHook,
11 numpy,
12 pandas,
13 pythonOlder,
14 scipy,
15 statsmodels,
16}:
17
18buildPythonPackage rec {
19 pname = "seaborn";
20 version = "0.13.2";
21 format = "pyproject";
22
23 disabled = pythonOlder "3.8";
24
25 src = fetchFromGitHub {
26 owner = "mwaskom";
27 repo = "seaborn";
28 tag = "v${version}";
29 hash = "sha256-aGIVcdG/XN999nYBHh3lJqGa3QVt0j8kmzaxdkULznY=";
30 };
31
32 patches = [
33 # https://github.com/mwaskom/seaborn/pull/3685
34 (fetchpatch2 {
35 name = "numpy_2-compatibility.patch";
36 url = "https://github.com/mwaskom/seaborn/commit/58f170fe799ef496adae19925d7d4f0f14f8da95.patch";
37 hash = "sha256-/a3G+kNIRv8Oa4a0jPGnL2Wvx/9umMoiq1BXcXpehAg=";
38 })
39 # https://github.com/mwaskom/seaborn/pull/3802
40 (fetchpatch2 {
41 name = "matplotlib_3_10-compatibility.patch";
42 url = "https://github.com/mwaskom/seaborn/commit/385e54676ca16d0132434bc9df6bc41ea8b2a0d4.patch";
43 hash = "sha256-nwGwTkP7W9QzgbbAVdb2rASgsMxqFnylMk8GnTE445w=";
44 })
45 ];
46
47 nativeBuildInputs = [ flit-core ];
48
49 propagatedBuildInputs = [
50 matplotlib
51 numpy
52 pandas
53 ];
54
55 optional-dependencies = {
56 stats = [
57 scipy
58 statsmodels
59 ];
60 };
61
62 nativeCheckInputs = [
63 pytest-xdist
64 pytestCheckHook
65 ];
66
67 disabledTests =
68 [
69 # requires internet connection
70 "test_load_dataset_string_error"
71 ]
72 ++ lib.optionals (!stdenv.hostPlatform.isx86) [
73 # overly strict float tolerances
74 "TestDendrogram"
75 ];
76
77 # All platforms should use Agg. Let's set it explicitly to avoid probing GUI
78 # backends (leads to crashes on macOS).
79 env.MPLBACKEND = "Agg";
80
81 pythonImportsCheck = [ "seaborn" ];
82
83 meta = with lib; {
84 description = "Statistical data visualization";
85 homepage = "https://seaborn.pydata.org/";
86 changelog = "https://github.com/mwaskom/seaborn/blob/master/doc/whatsnew/${src.rev}.rst";
87 license = with licenses; [ bsd3 ];
88 };
89}