1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 setuptools,
7 packaging,
8 tenacity,
9 kaleido,
10 pytestCheckHook,
11 pandas,
12 requests,
13 matplotlib,
14 xarray,
15 pillow,
16 scipy,
17 statsmodels,
18 ipython,
19 ipywidgets,
20 which,
21 nbformat,
22 scikit-image,
23 orca,
24 psutil,
25}:
26
27buildPythonPackage rec {
28 pname = "plotly";
29 version = "5.24.1";
30 pyproject = true;
31
32 src = fetchFromGitHub {
33 owner = "plotly";
34 repo = "plotly.py";
35 rev = "refs/tags/v${version}";
36 hash = "sha256-ONuX5/GlirPF8+7bZtib1Xsv5llcXcSelFfGyeTc5L8=";
37 };
38
39 sourceRoot = "${src.name}/packages/python/plotly";
40
41 postPatch = ''
42 substituteInPlace pyproject.toml \
43 --replace-fail "\"jupyterlab~=3.0;python_version>='3.6'\"," ""
44 '';
45
46 env.SKIP_NPM = true;
47
48 build-system = [ setuptools ];
49
50 dependencies = [
51 packaging
52 tenacity
53 kaleido
54 ];
55
56 # packages/python/plotly/optional-requirements.txt
57 optional-dependencies = {
58 orca = [
59 orca
60 requests
61 psutil
62 ];
63 };
64
65 nativeCheckInputs = [
66 pytestCheckHook
67 pandas
68 requests
69 matplotlib
70 xarray
71 pillow
72 scipy
73 statsmodels
74 ipython
75 ipywidgets
76 which
77 nbformat
78 scikit-image
79 ];
80
81 disabledTests = [
82 # failed pinning test, sensitive to dep versions
83 "test_legend_dots"
84 "test_linestyle"
85 # test bug, i assume sensitive to dep versions
86 "test_sanitize_json"
87 # requires vaex and polars, vaex is not packaged
88 "test_build_df_from_vaex_and_polars"
89 "test_build_df_with_hover_data_from_vaex_and_polars"
90 # lazy loading error, could it be the sandbox PYTHONPATH?
91 # AssertionError: assert "plotly" not in sys.modules
92 "test_dependencies_not_imported"
93 "test_lazy_imports"
94 ];
95 disabledTestPaths =
96 [
97 # unable to locate orca binary, adding the package does not fix it
98 "plotly/tests/test_orca/"
99 ]
100 ++ lib.optionals stdenv.hostPlatform.isDarwin [
101 # requires local networking
102 "plotly/tests/test_io/test_renderers.py"
103 # fails to launch kaleido subprocess
104 "plotly/tests/test_optional/test_kaleido"
105 ];
106
107 pythonImportsCheck = [ "plotly" ];
108
109 meta = {
110 description = "Python plotting library for collaborative, interactive, publication-quality graphs";
111 homepage = "https://plot.ly/python/";
112 downloadPage = "https://github.com/plotly/plotly.py";
113 changelog = "https://github.com/plotly/plotly.py/blob/master/CHANGELOG.md";
114 license = lib.licenses.mit;
115 maintainers = with lib.maintainers; [ pandapip1 ];
116 };
117}