1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchFromGitHub,
6
7 setuptools,
8 nodejs,
9 yarn,
10 fixup-yarn-lock,
11 fetchYarnDeps,
12
13 flask,
14 werkzeug,
15 plotly,
16 dash-html-components,
17 dash-core-components,
18 dash-table,
19 importlib-metadata,
20 typing-extensions,
21 requests,
22 retrying,
23 nest-asyncio,
24
25 celery,
26 redis,
27 diskcache,
28 multiprocess,
29 psutil,
30 flask-compress,
31
32 pytestCheckHook,
33 pytest-mock,
34 mock,
35 pyyaml,
36}:
37
38buildPythonPackage rec {
39 pname = "dash";
40 version = "2.17.1";
41 pyproject = true;
42
43 disabled = pythonOlder "3.8";
44
45 src = fetchFromGitHub {
46 owner = "plotly";
47 repo = "dash";
48 rev = "refs/tags/v${version}";
49 hash = "sha256-51/nMnXUhb+hTL4xS9x4urI+2eENo/8sEKtk/kt6xTk=";
50 };
51
52 nativeBuildInputs = [
53 setuptools
54 nodejs
55 yarn
56 fixup-yarn-lock
57 ];
58
59 yarnOfflineCache = fetchYarnDeps {
60 yarnLock = "${src}/@plotly/dash-jupyterlab/yarn.lock";
61 hash = "sha256-L/or8jO6uEypI5krwy/ElIxa6jJrXGsCRZ9mh+0kcGA=";
62 };
63
64 preBuild = ''
65 pushd @plotly/dash-jupyterlab
66
67 export HOME=$(mktemp -d)
68
69 yarn config --offline set yarn-offline-mirror ${yarnOfflineCache}
70 fixup-yarn-lock yarn.lock
71
72 substituteInPlace package.json --replace jlpm yarn
73 yarn install --offline --frozen-lockfile --ignore-engines --ignore-scripts
74 patchShebangs node_modules
75
76 # Generates the jupyterlab extension files
77 yarn run build:pack
78
79 popd
80 '';
81
82 propagatedBuildInputs = [
83 flask
84 werkzeug
85 plotly
86 dash-html-components
87 dash-core-components
88 dash-table
89 importlib-metadata
90 typing-extensions
91 requests
92 retrying
93 nest-asyncio
94 ];
95
96 passthru.optional-dependencies = {
97 celery = [
98 celery
99 redis
100 ];
101 diskcache = [
102 diskcache
103 multiprocess
104 psutil
105 ];
106 compress = [ flask-compress ];
107 };
108
109 nativeCheckInputs = [
110 pytestCheckHook
111 pytest-mock
112 mock
113 pyyaml
114 ];
115
116 disabledTestPaths = [
117 "tests/unit/test_browser.py"
118 "tests/unit/test_app_runners.py" # Uses selenium
119 "tests/integration"
120 ];
121
122 pythonImportsCheck = [ "dash" ];
123
124 meta = {
125 changelog = "https://github.com/plotly/dash/blob/${src.rev}/CHANGELOG.md";
126 description = "Python framework for building analytical web applications";
127 homepage = "https://dash.plot.ly/";
128 license = lib.licenses.mit;
129 maintainers = with lib.maintainers; [
130 antoinerg
131 tomasajt
132 ];
133 };
134}