1{ lib
2, stdenv
3, buildPythonPackage
4, fetchpatch
5, fetchPypi
6, flit-core
7, matplotlib
8, pytest-xdist
9, pytestCheckHook
10, numpy
11, pandas
12, pythonOlder
13, scipy
14}:
15
16buildPythonPackage rec {
17 pname = "seaborn";
18 version = "0.12.2";
19 format = "pyproject";
20
21 disabled = pythonOlder "3.6";
22
23 src = fetchPypi {
24 inherit pname version;
25 hash = "sha256-N0ZF82UJ0NyriVy6W0fa8Fhvd7/js2yXxgfbfaW+ATk=";
26 };
27
28 patches = [
29 (fetchpatch {
30 name = "fix-test-using-matplotlib-3.7.patch";
31 url = "https://github.com/mwaskom/seaborn/commit/db7ae11750fc2dfb695457239708448d54e9b8cd.patch";
32 hash = "sha256-LbieI0GeC/0NpFVxV/NRQweFjP/lj/TR2D/SLMPYqJg=";
33 })
34 (fetchpatch {
35 name = "fix-pandas-deprecation.patch";
36 url = "https://github.com/mwaskom/seaborn/commit/a48601d6bbf8381f9435be48624f1a77d6fbfced.patch";
37 hash = "sha256-LuN8jn6Jo9Fvdl5iGZ2LgINYujSDvvs+hSclnadV1F4=";
38 })
39 (fetchpatch {
40 name = "fix-tests-using-numpy-1.25.patch";
41 url = "https://github.com/mwaskom/seaborn/commit/b6737d5aec9a91bb8840cdda896a7970e1830d56.patch";
42 hash = "sha256-Xj82yyB5Vy2xKRl0ideDmJ5Zr4Xc+8cEHU/liVwMSvE=";
43 })
44 ];
45
46 nativeBuildInputs = [
47 flit-core
48 ];
49
50 propagatedBuildInputs = [
51 matplotlib
52 numpy
53 pandas
54 scipy
55 ];
56
57 nativeCheckInputs = [
58 pytest-xdist
59 pytestCheckHook
60 ];
61
62 disabledTests = [
63 # requires internet connection
64 "test_load_dataset_string_error"
65
66 # per https://github.com/mwaskom/seaborn/issues/3431, we can enable this
67 # once matplotlib releases version > 3.7.2
68 "test_share_xy"
69 ] ++ lib.optionals (!stdenv.hostPlatform.isx86) [
70 # overly strict float tolerances
71 "TestDendrogram"
72 ];
73
74 # All platforms should use Agg. Let's set it explicitly to avoid probing GUI
75 # backends (leads to crashes on macOS).
76 env.MPLBACKEND="Agg";
77
78 pythonImportsCheck = [
79 "seaborn"
80 ];
81
82 meta = with lib; {
83 description = "Statistical data visualization";
84 homepage = "https://seaborn.pydata.org/";
85 license = with licenses; [ bsd3 ];
86 maintainers = with maintainers; [ fridh ];
87 };
88}