Skip to content

Commit 57056cf

Browse files
committed
Rollback python install machinery
1 parent bfe997b commit 57056cf

File tree

2 files changed

+51
-52
lines changed

2 files changed

+51
-52
lines changed

toolbar-button/pyproject.toml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
11
[build-system]
2-
requires = ["jupyter_packaging~=0.10,<2", "jupyterlab~=3.0"]
3-
build-backend = "jupyter_packaging.build_api"
4-
5-
[tool.jupyter-packaging.options]
6-
skip-if-exists = ["jupyterlab_examples_toolbar_button/labextension/static/style.js"]
7-
ensured-targets = ["jupyterlab_examples_toolbar_button/labextension/static/style.js", "jupyterlab_examples_toolbar_button/labextension/package.json"]
8-
9-
[tool.jupyter-packaging.builder]
10-
factory = "jupyter_packaging.npm_builder"
11-
12-
[tool.jupyter-packaging.build-args]
13-
build_cmd = "build:prod"
14-
npm = ["jlpm"]
15-
16-
[tool.check-manifest]
17-
ignore = ["jupyterlab_examples_toolbar_button/labextension/**", "yarn.lock", ".*", "package-lock.json"]
2+
requires = ["jupyter_packaging~=0.7.9", "jupyterlab>=3.0.0rc15,==3.*", "setuptools>=40.8.0", "wheel"]
3+
build-backend = "setuptools.build_meta"

toolbar-button/setup.py

Lines changed: 49 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,80 @@
11
"""
2-
clear_cell_outputs setup
2+
jupyterlab_examples_toolbar_button setup
33
"""
44
import json
5-
from pathlib import Path
5+
import os
66

7+
from jupyter_packaging import (
8+
create_cmdclass, install_npm, ensure_targets,
9+
combine_commands, skip_if_exists
10+
)
711
import setuptools
812

9-
HERE = Path(__file__).parent.resolve()
13+
HERE = os.path.abspath(os.path.dirname(__file__))
1014

1115
# The name of the project
12-
name = "jupyterlab_examples_toolbar_button"
16+
name="jupyterlab_examples_toolbar_button"
17+
18+
# Get our version
19+
with open(os.path.join(HERE, 'package.json')) as f:
20+
version = json.load(f)['version']
1321

14-
lab_path = (HERE / name.replace("-", "_") / "labextension")
22+
lab_path = os.path.join(HERE, name, "labextension")
1523

1624
# Representative files that should exist after a successful build
17-
ensured_targets = [
18-
str(lab_path / "package.json"),
19-
str(lab_path / "static/style.js")
25+
jstargets = [
26+
os.path.join(lab_path, "package.json"),
2027
]
2128

29+
package_data_spec = {
30+
name: [
31+
"*"
32+
]
33+
}
34+
2235
labext_name = "@jupyterlab-examples/toolbar-button"
2336

2437
data_files_spec = [
25-
("share/jupyter/labextensions/%s" % labext_name, str(lab_path), "**"),
26-
("share/jupyter/labextensions/%s" % labext_name, str(HERE), "install.json"),
38+
("share/jupyter/labextensions/%s" % labext_name, lab_path, "**"),
39+
("share/jupyter/labextensions/%s" % labext_name, HERE, "install.json"),
2740
]
2841

29-
long_description = (HERE / "README.md").read_text()
42+
cmdclass = create_cmdclass("jsdeps",
43+
package_data_spec=package_data_spec,
44+
data_files_spec=data_files_spec
45+
)
46+
47+
js_command = combine_commands(
48+
install_npm(HERE, build_cmd="build:prod", npm=["jlpm"]),
49+
ensure_targets(jstargets),
50+
)
51+
52+
is_repo = os.path.exists(os.path.join(HERE, ".git"))
53+
if is_repo:
54+
cmdclass["jsdeps"] = js_command
55+
else:
56+
cmdclass["jsdeps"] = skip_if_exists(jstargets, js_command)
3057

31-
# Get the package info from package.json
32-
pkg_json = json.loads((HERE / "package.json").read_bytes())
58+
with open("README.md", "r") as fh:
59+
long_description = fh.read()
3360

3461
setup_args = dict(
3562
name=name,
36-
version=pkg_json["version"],
37-
url=pkg_json["homepage"],
38-
author=pkg_json["author"]["name"],
39-
author_email=pkg_json["author"]["email"],
40-
description=pkg_json["description"],
41-
license=pkg_json["license"],
42-
long_description=long_description,
63+
version=version,
64+
url="https://github.com/jupyterlab/extension-examples.git",
65+
author="Project Jupyter Contributors",
66+
description="minimal lab example",
67+
long_description= long_description,
4368
long_description_content_type="text/markdown",
69+
cmdclass= cmdclass,
4470
packages=setuptools.find_packages(),
4571
install_requires=[
46-
"jupyter_server>=1.6,<2"
72+
"jupyterlab>=3.0.0rc15,==3.*",
4773
],
4874
zip_safe=False,
4975
include_package_data=True,
5076
python_requires=">=3.6",
77+
license="BSD-3-Clause",
5178
platforms="Linux, Mac OS X, Windows",
5279
keywords=["Jupyter", "JupyterLab", "JupyterLab3"],
5380
classifiers=[
@@ -57,24 +84,10 @@
5784
"Programming Language :: Python :: 3.6",
5885
"Programming Language :: Python :: 3.7",
5986
"Programming Language :: Python :: 3.8",
60-
"Programming Language :: Python :: 3.9",
6187
"Framework :: Jupyter",
6288
],
6389
)
6490

65-
try:
66-
from jupyter_packaging import (
67-
wrap_installers,
68-
npm_builder,
69-
get_data_files
70-
)
71-
post_develop = npm_builder(
72-
build_cmd="install:extension", source_dir="src", build_dir=lab_path
73-
)
74-
setup_args['cmdclass'] = wrap_installers(post_develop=post_develop, ensured_targets=ensured_targets)
75-
setup_args['data_files'] = get_data_files(data_files_spec)
76-
except ImportError as e:
77-
pass
7891

7992
if __name__ == "__main__":
80-
setuptools.setup(**setup_args)
93+
setuptools.setup(**setup_args)

0 commit comments

Comments
 (0)