Skip to content

Commit 8911332

Browse files
authored
Merge pull request #448 from ianhi/model-version
Add model version separate from package version
2 parents 3e0a520 + a027447 commit 8911332

File tree

7 files changed

+32
-17
lines changed

7 files changed

+32
-17
lines changed

ipympl/_version.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
version_info = (0, 8, 8)
22
__version__ = '.'.join(map(str, version_info))
3-
js_semver = '^0.10.5'
3+
4+
5+
# The versions of protocol of communication with the frontend that this python verison knows
6+
# how to speak. See counterpart in the src/version.ts file.
7+
# These should not be changed unless we introduce changes to communication between
8+
# frontend and backend.
9+
__MODEL_VERSION__ = "1.0.0"

ipympl/backend_nbagg.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
observe,
5959
)
6060

61-
from ._version import js_semver
61+
from ._version import __MODEL_VERSION__
6262

6363
cursors_str = {
6464
cursors.HAND: 'pointer',
@@ -93,11 +93,11 @@ def connection_info():
9393
class Toolbar(DOMWidget, NavigationToolbar2WebAgg):
9494

9595
_model_module = Unicode('jupyter-matplotlib').tag(sync=True)
96-
_model_module_version = Unicode(js_semver).tag(sync=True)
96+
_model_module_version = Unicode(__MODEL_VERSION__).tag(sync=True)
9797
_model_name = Unicode('ToolbarModel').tag(sync=True)
9898

9999
_view_module = Unicode('jupyter-matplotlib').tag(sync=True)
100-
_view_module_version = Unicode(js_semver).tag(sync=True)
100+
_view_module_version = Unicode(__MODEL_VERSION__).tag(sync=True)
101101
_view_name = Unicode('ToolbarView').tag(sync=True)
102102

103103
toolitems = List().tag(sync=True)
@@ -180,11 +180,11 @@ def _on_orientation_collapsed_changed(self, change):
180180
class Canvas(DOMWidget, FigureCanvasWebAggCore):
181181

182182
_model_module = Unicode('jupyter-matplotlib').tag(sync=True)
183-
_model_module_version = Unicode(js_semver).tag(sync=True)
183+
_model_module_version = Unicode(__MODEL_VERSION__).tag(sync=True)
184184
_model_name = Unicode('MPLCanvasModel').tag(sync=True)
185185

186186
_view_module = Unicode('jupyter-matplotlib').tag(sync=True)
187-
_view_module_version = Unicode(js_semver).tag(sync=True)
187+
_view_module_version = Unicode(__MODEL_VERSION__).tag(sync=True)
188188
_view_name = Unicode('MPLCanvasView').tag(sync=True)
189189

190190
toolbar = Instance(Toolbar, allow_none=True).tag(sync=True, **widget_serialization)

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
'pillow',
6565
'traitlets<6',
6666
'ipywidgets>=7.6.0,<8',
67-
'matplotlib>=2.0.0,<4',
67+
'matplotlib>=3.4.0,<4',
6868
],
6969
extras_require={
7070
"docs": [

src/mpl_widget.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010

1111
import * as utils from './utils';
1212

13-
import { MODULE_VERSION } from './version';
13+
import { MODEL_VERSION } from './version';
1414

1515
import { ToolbarView } from './toolbar_widget';
1616

@@ -30,8 +30,8 @@ export class MPLCanvasModel extends DOMWidgetModel {
3030
_view_name: 'MPLCanvasView',
3131
_model_module: 'jupyter-matplotlib',
3232
_view_module: 'jupyter-matplotlib',
33-
_model_module_version: '^' + MODULE_VERSION,
34-
_view_module_version: '^' + MODULE_VERSION,
33+
_model_module_version: MODEL_VERSION,
34+
_view_module_version: MODEL_VERSION,
3535
header_visible: true,
3636
footer_visible: true,
3737
toolbar: null,

src/plugin.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Widget } from '@phosphor/widgets';
44

55
import { IJupyterWidgetRegistry } from '@jupyter-widgets/base';
66

7-
import { MODULE_NAME, MODULE_VERSION } from './version';
7+
import { MODEL_VERSION, MODULE_NAME } from './version';
88

99
const EXTENSION_ID = 'matplotlib-jupyter:main';
1010

@@ -31,7 +31,7 @@ function activateWidgetExtension(
3131
): void {
3232
registry.registerWidget({
3333
name: MODULE_NAME,
34-
version: MODULE_VERSION,
35-
exports: () => import('./index'),
34+
version: MODEL_VERSION,
35+
exports: (): any => import('./index'),
3636
});
3737
}

src/toolbar_widget.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { DOMWidgetModel, DOMWidgetView } from '@jupyter-widgets/base';
22

3-
import { MODULE_VERSION } from './version';
3+
import { MODEL_VERSION } from './version';
44

55
import '../css/mpl_widget.css';
66

@@ -12,8 +12,8 @@ export class ToolbarModel extends DOMWidgetModel {
1212
_view_name: 'ToolbarView',
1313
_model_module: 'jupyter-matplotlib',
1414
_view_module: 'jupyter-matplotlib',
15-
_model_module_version: '^' + MODULE_VERSION,
16-
_view_module_version: '^' + MODULE_VERSION,
15+
_model_module_version: MODEL_VERSION,
16+
_view_module_version: MODEL_VERSION,
1717
toolitems: [],
1818
position: 'left',
1919
button_style: '',

src/version.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,19 @@ const data = require('../package.json');
66
*
77
* The html widget manager assumes that this is the same as the npm package
88
* version number.
9+
*
10+
* See counterparts in the _version.py file
11+
* These should not be changed unless we introduce changes to communication between
12+
* frontend and backend.
913
*/
10-
export const MODULE_VERSION = data.version;
14+
export const MODEL_VERSION = '1.0.0';
1115

1216
/*
1317
* The current package name.
1418
*/
1519
export const MODULE_NAME = data.name;
20+
21+
/*
22+
* The package version
23+
*/
24+
export const MODULE_VERSION = data.version;

0 commit comments

Comments
 (0)