diff --git a/{{cookiecutter.github_project_name}}/package.json b/{{cookiecutter.github_project_name}}/package.json index 5a06cbc..cf0a45f 100644 --- a/{{cookiecutter.github_project_name}}/package.json +++ b/{{cookiecutter.github_project_name}}/package.json @@ -29,12 +29,12 @@ "url": "https://github.com/{{ cookiecutter.github_organization_name }}/{{ cookiecutter.github_project_name }}" }, "scripts": { - "build": "npm run build:lib && npm run build:nbextension", - "build:labextension": "npm run clean:labextension && mkdirp {{ cookiecutter.python_package_name }}/labextension && cd {{ cookiecutter.python_package_name }}/labextension && npm pack ../..", + "build": "npm run build:lib && npm run build:nbextension && npm run build:labextension", + "build:labextension": "jupyter labextension build .", + "build:labextension:dev": "jupyter labextension build --development True .", "build:lib": "tsc", "build:nbextension": "webpack -p", - "build:all": "npm run build:labextension && npm run build:nbextension", - "clean": "npm run clean:lib && npm run clean:nbextension", + "clean": "npm run clean:lib && npm run clean:nbextension && npm run clean:labextension", "clean:lib": "rimraf lib", "clean:labextension": "rimraf {{ cookiecutter.python_package_name }}/labextension", "clean:nbextension": "rimraf {{ cookiecutter.python_package_name }}/nbextension/static/index.js", @@ -51,9 +51,10 @@ "watch:nbextension": "webpack --watch" }, "dependencies": { - "@jupyter-widgets/base": "^1.1.10 || ^2 || ^3" + "@jupyter-widgets/base": "^1.1.10 || ^2 || ^3 || ^4" }, "devDependencies": { + "@jupyterlab/builder": "^3.0.0", "@phosphor/application": "^1.6.0", "@phosphor/widgets": "^1.6.0", "@types/expect.js": "^0.3.29", @@ -90,6 +91,13 @@ "webpack-cli": "^3.1.2" }, "jupyterlab": { - "extension": "lib/plugin" + "extension": "lib/plugin", + "outputDir": "{{ cookiecutter.python_package_name }}/labextension/", + "sharedPackages": { + "@jupyter-widgets/base": { + "bundled": false, + "singleton": true + } + } } } diff --git a/{{cookiecutter.github_project_name}}/setup.py b/{{cookiecutter.github_project_name}}/setup.py index 0f8e4bd..853e592 100644 --- a/{{cookiecutter.github_project_name}}/setup.py +++ b/{{cookiecutter.github_project_name}}/setup.py @@ -22,13 +22,14 @@ name = '{{ cookiecutter.python_package_name }}' # Ensure a valid python version -ensure_python('>=3.4') +ensure_python('>=3.6') # Get our version version = get_version(pjoin(name, '_version.py')) nb_path = pjoin(HERE, name, 'nbextension', 'static') -lab_path = pjoin(HERE, name, 'labextension') +# lab_path = pjoin(HERE, name, 'labextension') +lab3_path = pjoin(HERE, name, 'labextension') # Representative files that should exist after a successful build jstargets = [ @@ -39,14 +40,18 @@ package_data_spec = { name: [ 'nbextension/static/*.*js*', - 'labextension/*.tgz' + # 'labextension/*.tgz', + 'labextension/*' ] } +labext_name = "{{ cookiecutter.npm_package_name }}" + data_files_spec = [ ('share/jupyter/nbextensions/{{ cookiecutter.python_package_name}}', nb_path, '*.js*'), - ('share/jupyter/lab/extensions', lab_path, '*.tgz'), + ("share/jupyter/labextensions/%s" % labext_name, lab3_path, "*.*"), +# ('share/jupyter/lab/extensions', lab_path, '*.tgz'), ('etc/jupyter/nbconfig/notebook.d' , HERE, '{{ cookiecutter.python_package_name}}.json') ] @@ -54,7 +59,7 @@ cmdclass = create_cmdclass('jsdeps', package_data_spec=package_data_spec, data_files_spec=data_files_spec) cmdclass['jsdeps'] = combine_commands( - install_npm(HERE, build_cmd='build:all'), + install_npm(HERE, build_cmd='build'), ensure_targets(jstargets), ) @@ -85,6 +90,7 @@ 'Framework :: Jupyter', ], include_package_data = True, + python_requires=">=3.6", install_requires = [ 'ipywidgets>=7.0.0', ],