1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 fetchpatch,
6
7 # build-system
8 setuptools-scm,
9
10 # dependencies
11 matplotlib,
12 mizani,
13 pandas,
14 scipy,
15 statsmodels,
16
17 # tests
18 geopandas,
19 pytestCheckHook,
20 pytest-cov-stub,
21 scikit-misc,
22 writableTmpDirAsHomeHook,
23}:
24
25buildPythonPackage rec {
26 pname = "plotnine";
27 version = "0.15.0";
28 pyproject = true;
29
30 src = fetchFromGitHub {
31 owner = "has2k1";
32 repo = "plotnine";
33 tag = "v${version}";
34 hash = "sha256-HhsJE5XoQjkIVExsfikTBArh9uq8ob4g2O0byYOsOh8=";
35 };
36
37 build-system = [ setuptools-scm ];
38
39 patches = [
40 (fetchpatch {
41 name = "fix-composition-error-messages.patch";
42 url = "https://github.com/has2k1/plotnine/commit/097192de42d690c227b26ae7638accac0db14589.patch";
43 hash = "sha256-wxfJ36QH0PYdotgqrdE9sKAzKpcIYw7I8uNGhC6J0Gg=";
44 })
45 ];
46
47 dependencies = [
48 matplotlib
49 mizani
50 pandas
51 scipy
52 statsmodels
53 ];
54
55 nativeCheckInputs = [
56 geopandas
57 pytestCheckHook
58 pytest-cov-stub
59 scikit-misc
60 writableTmpDirAsHomeHook
61 ];
62
63 pythonImportsCheck = [ "plotnine" ];
64
65 disabledTests = [
66 # Tries to change locale. The issued warning causes this test to fail.
67 # UserWarning: Could not set locale to English/United States. Some date-related tests may fail
68 "test_no_after_scale_warning"
69
70 # Assertion Errors:
71 # Generated plot images do not exactly match the expected files.
72 # After manually checking, this is caused by extremely subtle differences in label placement.
73 # See https://github.com/has2k1/plotnine/issues/627
74 "test_aesthetics"
75 ];
76
77 disabledTestPaths = [
78 # Assertion Errors:
79 # Generated plot images do not exactly match the expected files.
80 # After manually checking, this is caused by extremely subtle differences in label placement.
81 "tests/test_aes.py"
82 "tests/test_annotation_logticks.py"
83 "tests/test_coords.py"
84 "tests/test_facet_labelling.py"
85 "tests/test_facets.py"
86 "tests/test_geom_bar_col_histogram.py"
87 "tests/test_geom_bin_2d.py"
88 "tests/test_geom_boxplot.py"
89 "tests/test_geom_count.py"
90 "tests/test_geom_density_2d.py"
91 "tests/test_geom_density.py"
92 "tests/test_geom_dotplot.py"
93 "tests/test_geom_freqpoly.py"
94 "tests/test_geom_map.py"
95 "tests/test_geom_path_line_step.py"
96 "tests/test_geom_point.py"
97 "tests/test_geom_pointdensity.py"
98 "tests/test_geom_polygon.py"
99 "tests/test_geom_raster.py"
100 "tests/test_geom_rect_tile.py"
101 "tests/test_geom_ribbon_area.py"
102 "tests/test_geom_sina.py"
103 "tests/test_geom_smooth.py"
104 "tests/test_geom_text_label.py"
105 "tests/test_geom_violin.py"
106 "tests/test_layout.py"
107 "tests/test_plot_composition.py"
108 "tests/test_position.py"
109 "tests/test_qplot.py"
110 "tests/test_scale_internals.py"
111 "tests/test_scale_labelling.py"
112 "tests/test_stat_ecdf.py"
113 "tests/test_stat_ellipse.py"
114 "tests/test_stat_function.py"
115 "tests/test_stat_summary.py"
116 "tests/test_theme.py"
117
118 # Linting / formatting: useless as it has nothing to do with the package functioning
119 # Disabling this prevents adding a dependency on 'ruff' and 'black'.
120 "tests/test_lint_and_format.py"
121 ];
122
123 meta = {
124 description = "Grammar of graphics for Python";
125 homepage = "https://plotnine.readthedocs.io/";
126 changelog = "https://github.com/has2k1/plotnine/releases/tag/${src.tag}";
127 license = lib.licenses.mit;
128 maintainers = with lib.maintainers; [ onny ];
129 };
130}