Skip to content

Commit

Permalink
ENH: Support for JupyterLab 2 (#301)
Browse files Browse the repository at this point in the history
* JupyterLab 2 compatebility

- Update the python package coupling to the JupyterLab extension to be
less strict, allowing for a coupling to `^1.1.2` instead of exactly
`^1.1.1`. This is very relevant if we make a small bump to the extension
but don't want to make a new release of qgrid, or if qgrid would be
installed by conda and it's availability was delayed so the newer npm
package was available but the python package was outdated and coupled to
the old versions specifically.
- Move various loaders that are only used by webpack to build the json
files from being dependencies to being devDependencies.
- Bump versions of various dependencies to avoid security issues found
in packages by npm.

* Use labextension link instead of install for local dev

A good rule of thumb according to this @vidartf.

ref: https://discourse.jupyter.org/t/about-jupyter-labextension-link-v-s-install/2201/2?u=consideratio
  • Loading branch information
consideRatio authored Apr 7, 2020
1 parent c57356d commit d5240d5
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ to do this.

#. If desired, install the labextension::

jupyter labextension install js/
jupyter labextension link js/

#. Run the notebook as you normally would with the following command::

Expand Down
31 changes: 16 additions & 15 deletions js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "qgrid2",
"version": "1.1.2",
"version": "1.1.3",
"description": "An Interactive Grid for Sorting and Filtering DataFrames in Jupyter Notebook",
"author": "Quantopian Inc.",
"main": "src/index.js",
Expand All @@ -16,27 +16,28 @@
],
"scripts": {
"clean": "rimraf dist/",
"prepublish": "webpack",
"prepare": "webpack",
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"jshint": "^2.9.5",
"rimraf": "^2.6.1",
"webpack": "^3.5.5"
"css-loader": "^3.4.2",
"expose-loader": "^0.7.5",
"file-loader": "^6.0.0",
"jshint": "^2.11.0",
"json-loader": "^0.5.7",
"rimraf": "^3.0.2",
"style-loader": "^1.1.3",
"webpack": "^4.42.0",
"webpack-cli": "^3.3.11"
},
"dependencies": {
"@jupyter-widgets/base": "^1.1 || ^2",
"@jupyter-widgets/controls": "^1.0.0 || ^1.5.1",
"css-loader": "^0.28.7",
"expose-loader": "^0.7.3",
"file-loader": "^0.11.2",
"@jupyter-widgets/base": "^1.1 || ^2 || ^3",
"@jupyter-widgets/controls": "^1 || ^2",
"jquery": "^3.2.1",
"jquery-ui-dist": "1.12.1",
"json-loader": "^0.5.4",
"moment": "^2.18.1",
"jquery-ui-dist": "^1.12.1",
"moment": "^2.24.0",
"slickgrid-qgrid": "0.0.5",
"style-loader": "^0.18.2",
"underscore": "^1.8.3"
"underscore": "^1.9.2"
},
"jshintConfig": {
"esversion": 6
Expand Down
4 changes: 2 additions & 2 deletions js/src/qgrid.widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class QgridModel extends widgets.DOMWidgetModel {
_view_name : 'QgridView',
_model_module : 'qgrid',
_view_module : 'qgrid',
_model_module_version : '^1.1.1',
_view_module_version : '^1.1.1',
_model_module_version : '^1.1.2',
_view_module_version : '^1.1.2',
_df_json: '',
_columns: {}
});
Expand Down
9 changes: 6 additions & 3 deletions js/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ module.exports = [
path: path.resolve(__dirname, '..', 'qgrid', 'static'),
libraryTarget: 'amd'
},
plugins: plugins
plugins: plugins,
mode: 'production'
},
{// Bundle for the notebook containing the custom widget views and models
//
Expand All @@ -61,7 +62,8 @@ module.exports = [
rules: rules
},
externals: ['@jupyter-widgets/base', '@jupyter-widgets/controls', 'base/js/dialog'],
plugins: plugins
plugins: plugins,
mode: 'production'
},
{// Embeddable qgrid bundle
//
Expand Down Expand Up @@ -89,6 +91,7 @@ module.exports = [
rules: rules
},
externals: ['@jupyter-widgets/base', '@jupyter-widgets/controls'],
plugins: plugins
plugins: plugins,
mode: 'production'
}
];
2 changes: 1 addition & 1 deletion qgrid/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version_info = (1, 3, 0, "final")
version_info = (1, 3, 1, "final")

_specifier_ = {"alpha": "a", "beta": "b", "candidate": "rc", "final": ""}

Expand Down
4 changes: 2 additions & 2 deletions qgrid/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,8 +566,8 @@ class can be constructed directly but that's not recommended because
_model_name = Unicode('QgridModel').tag(sync=True)
_view_module = Unicode('qgrid').tag(sync=True)
_model_module = Unicode('qgrid').tag(sync=True)
_view_module_version = Unicode('1.1.1').tag(sync=True)
_model_module_version = Unicode('1.1.1').tag(sync=True)
_view_module_version = Unicode('^1.1.3').tag(sync=True)
_model_module_version = Unicode('^1.1.3').tag(sync=True)

_df = Instance(pd.DataFrame)
_df_json = Unicode('', sync=True)
Expand Down

0 comments on commit d5240d5

Please sign in to comment.