Skip to content
Permalink
Browse files

Further attempts at JupyterLab integration

  • Loading branch information...
danlester committed Jul 24, 2019
1 parent f2fd112 commit 9e14cb83c6c0197db10806bf8fa989c9a96ea50f
@@ -24,4 +24,10 @@ Development install
pip install -e .

jupyter nbextension install --py --symlink --sys-prefix jupyter_innotater
jupyter nbextension enable --py --sys-prefix jupyter_innotater
jupyter nbextension enable --py --sys-prefix jupyter_innotater


# Maybe also:
pip install ipywidgets
jupyter nbextension install --py widgetsnbextension
jupyter nbextension enable widgetsnbextension --py

This file was deleted.

@@ -24,15 +24,16 @@ var $ = require('jquery');
// When serialiazing the entire widget state for embedding, only values that
// differ from the defaults will be specified.

var version = require('../package.json').version;

var InnotaterImagePadModel = controls.ImageModel.extend({
defaults: _.extend(controls.ImageModel.prototype.defaults(), {
/*_model_name: 'InnotaterImagePadModel',
_model_name: 'InnotaterImagePadModel',
_view_name: 'InnotaterImagePadView',
_model_module: 'jupyter-innotater',
_view_module: 'jupyter-innotater',
_model_module_version: '0.1.0',
_view_module_version: '0.1.0', */
_model_module_version: version,
_view_module_version: version
/*rect: [0,0,0,0],
is_bb_source: false */
})
@@ -19,15 +19,16 @@ var $ = require('jquery');
//
// when different from the base class.

var version = require('../package.json').version;

var InnotaterModel = controls.VBoxModel.extend({
defaults: _.extend(controls.VBoxModel.prototype.defaults(), {
/* _model_name: 'InnotaterModel',
_model_name: 'InnotaterModel',
_view_name: 'InnotaterView',
_model_module: 'jupyter-innotater',
_view_module: 'jupyter-innotater',
_model_module_version: '0.1.0',
_view_module_version: '0.1.0' */
_model_module_version: version,
_view_module_version: version
})
});

@@ -1,17 +1,24 @@
"use strict";
//Object.defineProperty(exports, "__esModule", { value: true });

var innotater = require('./embed.js');

var base = require('@jupyter-widgets/base');

module.exports = {
id: 'innotater',
const innotaterPlugin = {
id: 'jupyter-innotater',
requires: [base.IJupyterWidgetRegistry],
activate: function(app, widgets) {
console.log("JL Innotater activated");
console.log(innotater.version);

widgets.registerWidget({
name: 'innotater',
name: 'jupyter-innotater',
version: innotater.version,
exports: innotater
});
},
autoStart: true
};

exports.default = innotaterPlugin;
@@ -1,6 +1,6 @@
{
"name": "jupyter-innotater",
"version": "0.1.5",
"version": "0.1.6",
"description": "An Inline Data Annotator for Jupyter",
"author": "danlester",
"license": "MIT",
@@ -15,33 +15,33 @@
"ipython",
"ipywidgets"
],
"files": [
"dist/*.js"
],
"scripts": {
"clean": "rimraf dist/ && rimraf ../jupyter_innotater/static/",
"cleanall": "npm run clean && rimraf node_modules/",
"prepare": "webpack",
"build": "webpack --mode=production",
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "watch 'npm run prepare' lib/"
"watch": "watch 'npm run build' lib/",
"watch:nbextension": "webpack --watch --mode=development lib/"
},
"jupyterlab": {
"extension": "lib/labplugin"
},
"devDependencies": {
"css-loader": "^0.28.7",
"less": "^2.7.2",
"less-loader": "^4.0.5",
"rimraf": "^2.6.1",
"style-loader": "^0.18.2",
"source-map-loader": "^0.2.4",
"watch": "^1.0.2",
"webpack": "^3.5.5",
"webpack": "^4.29.3",
"webpack-cli": "^3.2.3",
"webpack-build-notifier": "^0.1.30"
},
"dependencies": {
"@jupyter-widgets/base": "^1.0.0",
"@jupyter-widgets/controls": "^1.0.0",
"d3": "^4.10.2",
"lodash": "^4.17.4"
},
"jupyterlab": {
"extension": "lib/labplugin"
}
}
@@ -6,9 +6,17 @@ var WebpackBuildNotifierPlugin = require('webpack-build-notifier');
// stored in a separate local variable.
var rules = [
{ test: /\.css$/, use: ['style-loader', 'css-loader'] },
{ test: /\.less$/, use: ['style-loader', 'css-loader', 'less-loader'] }
{ test: /\.less$/, use: ['style-loader', 'css-loader', 'less-loader'] },
{
test: /\.(js|ts)$/,
use: ['source-map-loader'],
enforce: 'pre'
}
];

var resolve = {
extensions: ['.js']
};

module.exports = [
{// Notebook extension
@@ -20,6 +28,7 @@ module.exports = [
// extension.
//
entry: './lib/extension.js',
resolve: resolve,
output: {
filename: 'extension.js',
path: path.resolve(__dirname, '..', 'jupyter_innotater', 'static'),
@@ -34,6 +43,7 @@ module.exports = [
// It must be an amd module
//
entry: './lib/index.js',
resolve: resolve,
output: {
filename: 'index.js',
path: path.resolve(__dirname, '..', 'jupyter_innotater', 'static'),
@@ -67,6 +77,7 @@ module.exports = [
// by the custom widget embedder.
//
entry: './lib/embed.js',
resolve: resolve,
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'dist'),
@@ -13,5 +13,5 @@ def _get_version(version_info):
# meta data - change alpha/dev to final for release
# also change in package.json

version_info = (0, 1, 5, 'final', 0)
version_info = (0, 1, 6, 'final', 0)
__version__ = _get_version(version_info)
@@ -8,8 +8,8 @@ class ImagePad(widgets.Image):
_model_name = Unicode('InnotaterImagePadModel').tag(sync=True)
_view_module = Unicode('jupyter-innotater').tag(sync=True)
_model_module = Unicode('jupyter-innotater').tag(sync=True)
_view_module_version = Unicode('~0.1.0').tag(sync=True)
_model_module_version = Unicode('~0.1.0').tag(sync=True)
_view_module_version = Unicode('~0.1.6').tag(sync=True)
_model_module_version = Unicode('~0.1.6').tag(sync=True)

# rect = List(trait=Int).tag(sync=True)
rects = List(trait=Int).tag(sync=True)
@@ -10,8 +10,8 @@ class Innotater(VBox):
_model_name = Unicode('InnotaterModel').tag(sync=True)
_view_module = Unicode('jupyter-innotater').tag(sync=True)
_model_module = Unicode('jupyter-innotater').tag(sync=True)
_view_module_version = Unicode('~0.1.0').tag(sync=True)
_model_module_version = Unicode('~0.1.0').tag(sync=True)
_view_module_version = Unicode('~0.1.6').tag(sync=True)
_model_module_version = Unicode('~0.1.6').tag(sync=True)

index = Int().tag(sync=True)
keyboard_shortcuts = Bool(False).tag(sync=True)

0 comments on commit 9e14cb8

Please sign in to comment.
You can’t perform that action at this time.