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