-
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
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4b1805f
Update for jlab 3
jasongrout eceb791
add builder dependency
jasongrout 84cc68f
Update builder dependency
jasongrout a5031a1
Polish lab extension paths and build process
jasongrout a9374b2
Update to jlab 3 final release
jasongrout File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||||||
], | ||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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