|
| 1 | +# Copyright (c) Jupyter Development Team. |
| 2 | +# Distributed under the terms of the Modified BSD License. |
| 3 | + |
1 | 4 | """
|
2 | 5 | jupyterlab_widgets setup
|
3 | 6 | """
|
4 |
| -import os |
5 |
| - |
6 | 7 | from jupyter_packaging import (
|
7 | 8 | create_cmdclass, install_npm, ensure_targets,
|
8 | 9 | combine_commands, ensure_python, get_version,
|
9 | 10 | skip_if_exists
|
10 | 11 | )
|
11 |
| -import setuptools |
| 12 | +from pathlib import Path |
| 13 | +from setuptools import setup |
12 | 14 |
|
13 |
| -HERE = os.path.abspath(os.path.dirname(__file__)) |
| 15 | +HERE = Path(__file__).parent.resolve() |
| 16 | +IS_REPO = (HERE.parent / '.git').exists() |
| 17 | +LAB_PATH = HERE / "jupyterlab_widgets" / "labextension" |
14 | 18 |
|
15 | 19 | # The name of the project
|
16 | 20 | name = "jupyterlab_widgets"
|
17 |
| - |
18 |
| -# Ensure a valid python version |
19 |
| -ensure_python(">=3.6") |
20 |
| - |
21 |
| -# Get our version |
22 |
| -version = get_version(os.path.join(name, "_version.py")) |
23 |
| - |
24 |
| -lab_path = os.path.join(HERE, name, "labextension") |
| 21 | +labext_name = "@jupyter-widgets/jupyterlab-manager" |
25 | 22 |
|
26 | 23 | # Representative files that should exist after a successful build
|
27 |
| -jstargets = [ |
28 |
| - os.path.join(lab_path, "package.json"), |
29 |
| -] |
| 24 | +jstargets = [LAB_PATH / "package.json"] |
30 | 25 |
|
31 |
| -package_data_spec = { |
32 |
| - name: [ |
33 |
| - "*" |
34 |
| - ] |
35 |
| -} |
36 |
| - |
37 |
| -labext_name = "@jupyter-widgets/jupyterlab-manager" |
| 26 | +package_data_spec = {name: ["*"]} |
38 | 27 |
|
39 | 28 | data_files_spec = [
|
40 |
| - ("share/jupyter/labextensions/%s" % labext_name, lab_path, "**"), |
41 |
| - ("share/jupyter/labextensions/%s" % labext_name, HERE, "install.json"), |
| 29 | + (f"share/jupyter/labextensions/{labext_name}", LAB_PATH, "**"), |
| 30 | + (f"share/jupyter/labextensions/{labext_name}", HERE, "install.json"), |
42 | 31 | ]
|
43 | 32 |
|
44 | 33 | cmdclass = create_cmdclass(
|
|
55 | 44 | ensure_targets(jstargets),
|
56 | 45 | )
|
57 | 46 |
|
58 |
| -is_repo = os.path.exists(os.path.join(HERE, os.pardir, ".git")) |
59 |
| -if is_repo: |
| 47 | +if IS_REPO: |
60 | 48 | cmdclass["jsdeps"] = js_command
|
61 | 49 | else:
|
62 | 50 | cmdclass["jsdeps"] = skip_if_exists(jstargets, js_command)
|
63 | 51 |
|
64 |
| -with open("README.md", "r") as fh: |
65 |
| - long_description = fh.read() |
66 |
| - |
67 |
| -setup_args = dict( |
68 |
| - name=name, |
69 |
| - version=version, |
70 |
| - url="https://github.com/jupyter-widgets/ipywidgets", |
71 |
| - author="Jupyter Development Team", |
72 |
| - description="A JupyterLab extension.", |
73 |
| - long_description= long_description, |
74 |
| - long_description_content_type="text/markdown", |
75 |
| - cmdclass=cmdclass, |
76 |
| - packages=setuptools.find_packages(), |
77 |
| - install_requires=[], |
78 |
| - zip_safe=False, |
79 |
| - include_package_data=True, |
80 |
| - python_requires=">=3.6", |
81 |
| - license="BSD-3-Clause", |
82 |
| - platforms="Linux, Mac OS X, Windows", |
83 |
| - keywords=["Jupyter", "JupyterLab", "JupyterLab3"], |
84 |
| - classifiers=[ |
85 |
| - "License :: OSI Approved :: BSD License", |
86 |
| - "Programming Language :: Python", |
87 |
| - "Programming Language :: Python :: 3", |
88 |
| - "Programming Language :: Python :: 3.6", |
89 |
| - "Programming Language :: Python :: 3.7", |
90 |
| - "Programming Language :: Python :: 3.8", |
91 |
| - "Framework :: Jupyter", |
92 |
| - ], |
93 |
| -) |
94 |
| - |
95 |
| - |
96 | 52 | if __name__ == "__main__":
|
97 |
| - setuptools.setup(**setup_args) |
| 53 | + setup(cmdclass=cmdclass) |
0 commit comments