Skip to content

Commit b2e5292

Browse files
author
Frédéric Collonval
committed
Condition packaged data on skip npm
1 parent 71fe11c commit b2e5292

File tree

2 files changed

+21
-22
lines changed

2 files changed

+21
-22
lines changed

packages/python/plotly/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[build-system]
2-
requires = ["jupyterlab~=3.0", "setuptools>=40.8.0", "wheel"]
2+
requires = ["jupyterlab~=3.0;python_version>='3.6'", "setuptools>=40.8.0", "wheel"]
33
build-backend = "setuptools.build_meta"

packages/python/plotly/setup.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,26 @@ def update_package_data(distribution):
9292
"""update package_data to catch changes during setup"""
9393
build_py = distribution.get_command_obj("build_py")
9494

95-
# Add JupyterLab extension static files as their names are unknown
96-
distribution.data_files.append(
97-
(
98-
"share/jupyter/labextensions/plotlywidget/static",
99-
[os.path.join(labstatic, f) for f in os.listdir(labstatic)],
95+
# JS assets will not be present if we are skip npm build
96+
if not skip_npm:
97+
distribution.data_files.append(
98+
(
99+
"share/jupyter/labextensions/plotlywidget",
100+
["plotlywidget/labextension/package.json",],
101+
),
102+
(
103+
"share/jupyter/labextensions/plotlywidget/static",
104+
[os.path.join(labstatic, f) for f in os.listdir(labstatic)],
105+
),
106+
(
107+
"share/jupyter/nbextensions/plotlywidget",
108+
[
109+
"plotlywidget/nbextension/extension.js",
110+
"plotlywidget/nbextension/index.js",
111+
"plotlywidget/nbextension/index.js.LICENSE.txt",
112+
],
113+
),
100114
)
101-
)
102115

103116
# re-init build_py options which load package_data
104117
build_py.finalize_options()
@@ -531,21 +544,7 @@ def run(self):
531544
],
532545
"plotlywidget": ["nbextension/*", "labextension/*", "labextension/static/*"],
533546
},
534-
data_files=[
535-
(
536-
"share/jupyter/labextensions/plotlywidget",
537-
["plotlywidget/labextension/package.json",],
538-
),
539-
(
540-
"share/jupyter/nbextensions/plotlywidget",
541-
[
542-
"plotlywidget/nbextension/extension.js",
543-
"plotlywidget/nbextension/index.js",
544-
"plotlywidget/nbextension/index.js.LICENSE.txt",
545-
],
546-
),
547-
("etc/jupyter/nbconfig/notebook.d", ["plotlywidget.json"]),
548-
],
547+
data_files=[("etc/jupyter/nbconfig/notebook.d", ["plotlywidget.json"]),],
549548
install_requires=["retrying>=1.3.3", "six"],
550549
zip_safe=False,
551550
cmdclass=dict(

0 commit comments

Comments
 (0)