diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 507167933e2..5d9af92abbd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,8 +43,7 @@ jobs: ${{ runner.os }}-yarn- - name: Install dependencies run: | - python -m pip install jupyterlab~=3.0 - python -m pip install jupyter_packaging + python -m pip install jupyterlab~=3.0 jupyter_packaging~=0.9 check-manifest - name: Build the extension run: | pip install . @@ -57,3 +56,5 @@ jobs: jupyter labextension list python -m jupyterlab.browser_check + + check-manifest -v diff --git a/jupyterlab_widgets/package.json b/jupyterlab_widgets/package.json index bd387f95807..8fa0c23a9f0 100644 --- a/jupyterlab_widgets/package.json +++ b/jupyterlab_widgets/package.json @@ -31,7 +31,7 @@ ], "scripts": { "build": "jlpm run build:lib && jlpm run build:labextension:dev", - "build:prod": "jlpm run build:lib && jlpm run build:labextension", + "build:prod": "jlpm run clean && jlpm run build:lib && jlpm run build:labextension", "build:labextension": "jupyter labextension build .", "build:labextension:dev": "jupyter labextension build --development True .", "build:lib": "tsc", @@ -41,7 +41,7 @@ "clean:lib": "rimraf lib tsconfig.tsbuildinfo", "eslint": "eslint . --ext .ts,.tsx --fix", "eslint:check": "eslint . --ext .ts,.tsx", - "install:extension": "jupyter labextension develop --overwrite .", + "install:extension": "jlpm run build", "prepare": "jlpm run clean && jlpm run build:prod", "watch": "run-p watch:src watch:labextension", "watch:labextension": "jupyter labextension watch .", diff --git a/jupyterlab_widgets/pyproject.toml b/jupyterlab_widgets/pyproject.toml index ba04c53f810..124fa3822a7 100644 --- a/jupyterlab_widgets/pyproject.toml +++ b/jupyterlab_widgets/pyproject.toml @@ -1,3 +1,13 @@ [build-system] -requires = ["jupyter_packaging~=0.7.9", "jupyterlab~=3.0", "setuptools>=40.8.0", "wheel"] -build-backend = "setuptools.build_meta" +requires = ["jupyter_packaging~=0.9,<1", "jupyterlab~=3.0"] +build-backend = "jupyter_packaging.build_api" + +[tool.jupyter-packaging.builder] +factory = "jupyter_packaging.npm_builder" + +[tool.jupyter-packaging.build-args] +build_cmd = "build:prod" +npm = ["jlpm"] + +[tool.check-manifest] +ignore = ["jupyterlab_widgets/labextension/**", "yarn.lock", ".*", "package-lock.json"] diff --git a/jupyterlab_widgets/setup.cfg b/jupyterlab_widgets/setup.cfg index 555d6f328ee..29a85ec9be6 100644 --- a/jupyterlab_widgets/setup.cfg +++ b/jupyterlab_widgets/setup.cfg @@ -30,3 +30,5 @@ python_requires = >=3.6 zip_safe=False include_package_data = True packages = find: +install_requires = + jupyter_packaging~=0.9,<1 \ No newline at end of file diff --git a/jupyterlab_widgets/setup.py b/jupyterlab_widgets/setup.py index dcb777c8190..858a57cfe4e 100644 --- a/jupyterlab_widgets/setup.py +++ b/jupyterlab_widgets/setup.py @@ -5,9 +5,9 @@ jupyterlab_widgets setup """ from jupyter_packaging import ( - create_cmdclass, install_npm, ensure_targets, - combine_commands, ensure_python, get_version, - skip_if_exists + wrap_installers, + npm_builder, + get_data_files ) from pathlib import Path from setuptools import setup @@ -21,33 +21,21 @@ labext_name = "@jupyter-widgets/jupyterlab-manager" # Representative files that should exist after a successful build -jstargets = [LAB_PATH / "package.json"] - -package_data_spec = {name: ["*"]} +ensured_targets = [LAB_PATH / "package.json"] data_files_spec = [ (f"share/jupyter/labextensions/{labext_name}", LAB_PATH, "**"), (f"share/jupyter/labextensions/{labext_name}", HERE, "install.json"), ] -cmdclass = create_cmdclass( - "jsdeps", - package_data_spec=package_data_spec, - data_files_spec=data_files_spec -) - -# if the static assets already exist, do not invoke npm so we can make a wheel -# from the sdist package, since the npm build really only works from this -# repo. -js_command = combine_commands( - install_npm(HERE, build_cmd="build:prod", npm=["jlpm"]), - ensure_targets(jstargets), +post_develop = npm_builder( + build_cmd="install:extension", source_dir="src", build_dir=LAB_PATH ) -if IS_REPO: - cmdclass["jsdeps"] = js_command -else: - cmdclass["jsdeps"] = skip_if_exists(jstargets, js_command) +cmdclass = wrap_installers(post_develop=post_develop, ensured_targets=ensured_targets) if __name__ == "__main__": - setup(cmdclass=cmdclass) + setup( + cmdclass=cmdclass, + data_files=get_data_files(data_files_spec), + )