|
2 | 2 | jupyterlab-interactive-dashboard-editor setup |
3 | 3 | """ |
4 | 4 | import json |
5 | | -import os |
| 5 | +from os import path |
6 | 6 |
|
7 | 7 | from jupyter_packaging import ( |
8 | 8 | create_cmdclass, install_npm, ensure_targets, |
9 | 9 | combine_commands, skip_if_exists |
10 | 10 | ) |
| 11 | + |
11 | 12 | import setuptools |
12 | 13 |
|
13 | | -HERE = os.path.abspath(os.path.dirname(__file__)) |
| 14 | +HERE = path.abspath(path.dirname(__file__)) |
14 | 15 |
|
15 | 16 | # The name of the project |
16 | | -name="jupyterlab-interactive-dashboard-editor" |
| 17 | +name = "jupyterlab-interactive-dashboard-editor" |
| 18 | +module = "jupyterlab_interactive_dashboard_editor" |
| 19 | +labext_name = "jupyterlab-interactive-dashboard-editor" |
17 | 20 |
|
18 | 21 | # Get our version |
19 | | -with open(os.path.join(HERE, 'package.json')) as f: |
| 22 | +with open(path.join(HERE, 'package.json')) as f: |
20 | 23 | version = json.load(f)['version'] |
21 | 24 |
|
22 | | -lab_path = os.path.join(HERE, name, "labextension") |
| 25 | +lab_path = path.join(HERE, module, "labextension") |
23 | 26 |
|
24 | 27 | # Representative files that should exist after a successful build |
25 | 28 | jstargets = [ |
26 | | - os.path.join(lab_path, "package.json"), |
| 29 | + path.join(lab_path, "package.json"), |
27 | 30 | ] |
28 | 31 |
|
29 | 32 | package_data_spec = { |
30 | | - name: [ |
31 | | - "*" |
| 33 | + module: [ |
| 34 | + "labextension/*" |
32 | 35 | ] |
33 | 36 | } |
34 | 37 |
|
35 | | -labext_name = "jupyterlab-interactive-dashboard-editor" |
36 | 38 |
|
37 | 39 | data_files_spec = [ |
38 | | - ("share/jupyter/labextensions/%s" % labext_name, lab_path, "**"), |
39 | | - ("share/jupyter/labextensions/%s" % labext_name, HERE, "install.json"), |
| 40 | + ("share/jupyter/labextensions/%s" % labext_name, lab_path, "**") |
40 | 41 | ] |
41 | 42 |
|
42 | | -cmdclass = create_cmdclass("jsdeps", |
| 43 | + |
| 44 | +cmdclass = create_cmdclass("js", |
43 | 45 | package_data_spec=package_data_spec, |
44 | 46 | data_files_spec=data_files_spec |
45 | 47 | ) |
46 | 48 |
|
47 | | -js_command = combine_commands( |
48 | | - install_npm(HERE, build_cmd="build:prod", npm=["jlpm"]), |
| 49 | +cmdclass['js'] = combine_commands( |
| 50 | + install_npm( |
| 51 | + path=HERE, |
| 52 | + npm=["jlpm"], |
| 53 | + build_cmd="build:labextension", |
| 54 | + build_dir=path.join(HERE, 'dist'), |
| 55 | + source_dir=path.join(HERE, 'src') |
| 56 | + ), |
49 | 57 | ensure_targets(jstargets), |
50 | 58 | ) |
51 | 59 |
|
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) |
57 | | - |
58 | 60 | with open("README.md", "r") as fh: |
59 | 61 | long_description = fh.read() |
60 | 62 |
|
|
64 | 66 | url="https://github.com/jupytercalpoly/jupyterlab-interactive-dashboard-editor.git", |
65 | 67 | author="jupytercalpoly", |
66 | 68 | description="Interactively create and customize dashboards in JupyterLab", |
67 | | - long_description= long_description, |
| 69 | + long_description=long_description, |
68 | 70 | long_description_content_type="text/markdown", |
69 | | - cmdclass= cmdclass, |
| 71 | + cmdclass=cmdclass, |
70 | 72 | packages=setuptools.find_packages(), |
71 | 73 | install_requires=[ |
72 | 74 | "jupyterlab>=3.0.0rc13,==3.*", |
|
88 | 90 | ], |
89 | 91 | ) |
90 | 92 |
|
91 | | - |
92 | 93 | if __name__ == "__main__": |
93 | 94 | setuptools.setup(**setup_args) |
0 commit comments