-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update for JupyterLab 3 #83
Changes from all commits
4b1805f
eceb791
84cc68f
a5031a1
a9374b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 .", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We might want to make the |
||
"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, | ||
vidartf marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"singleton": true | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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,22 +40,26 @@ | |||||
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, "*.*"), | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the JupyterLab extension cookiecutter:
Suggested change
|
||||||
# ('share/jupyter/lab/extensions', lab_path, '*.tgz'), | ||||||
vidartf marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
('etc/jupyter/nbconfig/notebook.d' , HERE, '{{ cookiecutter.python_package_name}}.json') | ||||||
] | ||||||
|
||||||
|
||||||
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', | ||||||
], | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it actually a good idea to change this line? I personally develop mostly in Jupyter Notebook, and having
npm run build
trigger ajupyter labextension build .
is not very friendly with this workflow, it will simply fail in envs where JupyterLab is not installed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, is it actually supposed to work with JupyterLab 2? It seems to fail with
Please supply at least one subcommand: check, disable, enable, install, link, list, uninstall, unlink, update