From 46716af666522b75a78c7d982e3ad631ada764fe Mon Sep 17 00:00:00 2001 From: Ian Hunt-Isaak Date: Thu, 31 Mar 2022 17:34:31 -0400 Subject: [PATCH 1/3] update black version avoids: https://github.com/psf/black/issues/2964 --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 36525bc5..9401a31d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: hooks: - id: isort - repo: https://github.com/psf/black - rev: 21.12b0 + rev: 22.3.0 hooks: - id: black - repo: https://github.com/asottile/pyupgrade From e36bce80e97aa99bafdd9c06360dcac29a023cf1 Mon Sep 17 00:00:00 2001 From: Ian Hunt-Isaak Date: Thu, 31 Mar 2022 17:35:14 -0400 Subject: [PATCH 2/3] bump min matplotlib version This was already too low - previously was 3.3.1. With update of doubleclick we now need to require 3.4 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 43481296..2272531f 100644 --- a/setup.py +++ b/setup.py @@ -64,7 +64,7 @@ 'pillow', 'traitlets<6', 'ipywidgets>=7.6.0,<8', - 'matplotlib>=2.0.0,<4', + 'matplotlib>=3.4.0,<4', ], extras_require={ "docs": [ From a0274477e2dad78cdf6fef6fc4c0a8c229bbbd3e Mon Sep 17 00:00:00 2001 From: Ian Hunt-Isaak Date: Thu, 31 Mar 2022 17:43:32 -0400 Subject: [PATCH 3/3] Add model version separate from package version to allow compatibility between patch releases. --- ipympl/_version.py | 8 +++++++- ipympl/backend_nbagg.py | 10 +++++----- src/mpl_widget.ts | 6 +++--- src/plugin.ts | 6 +++--- src/toolbar_widget.ts | 6 +++--- src/version.ts | 11 ++++++++++- 6 files changed, 31 insertions(+), 16 deletions(-) diff --git a/ipympl/_version.py b/ipympl/_version.py index a7041c4b..50687298 100644 --- a/ipympl/_version.py +++ b/ipympl/_version.py @@ -1,3 +1,9 @@ version_info = (0, 8, 8) __version__ = '.'.join(map(str, version_info)) -js_semver = '^0.10.5' + + +# The versions of protocol of communication with the frontend that this python verison knows +# how to speak. See counterpart in the src/version.ts file. +# These should not be changed unless we introduce changes to communication between +# frontend and backend. +__MODEL_VERSION__ = "1.0.0" diff --git a/ipympl/backend_nbagg.py b/ipympl/backend_nbagg.py index e740cef8..f2eda2d3 100644 --- a/ipympl/backend_nbagg.py +++ b/ipympl/backend_nbagg.py @@ -58,7 +58,7 @@ observe, ) -from ._version import js_semver +from ._version import __MODEL_VERSION__ cursors_str = { cursors.HAND: 'pointer', @@ -93,11 +93,11 @@ def connection_info(): class Toolbar(DOMWidget, NavigationToolbar2WebAgg): _model_module = Unicode('jupyter-matplotlib').tag(sync=True) - _model_module_version = Unicode(js_semver).tag(sync=True) + _model_module_version = Unicode(__MODEL_VERSION__).tag(sync=True) _model_name = Unicode('ToolbarModel').tag(sync=True) _view_module = Unicode('jupyter-matplotlib').tag(sync=True) - _view_module_version = Unicode(js_semver).tag(sync=True) + _view_module_version = Unicode(__MODEL_VERSION__).tag(sync=True) _view_name = Unicode('ToolbarView').tag(sync=True) toolitems = List().tag(sync=True) @@ -180,11 +180,11 @@ def _on_orientation_collapsed_changed(self, change): class Canvas(DOMWidget, FigureCanvasWebAggCore): _model_module = Unicode('jupyter-matplotlib').tag(sync=True) - _model_module_version = Unicode(js_semver).tag(sync=True) + _model_module_version = Unicode(__MODEL_VERSION__).tag(sync=True) _model_name = Unicode('MPLCanvasModel').tag(sync=True) _view_module = Unicode('jupyter-matplotlib').tag(sync=True) - _view_module_version = Unicode(js_semver).tag(sync=True) + _view_module_version = Unicode(__MODEL_VERSION__).tag(sync=True) _view_name = Unicode('MPLCanvasView').tag(sync=True) toolbar = Instance(Toolbar, allow_none=True).tag(sync=True, **widget_serialization) diff --git a/src/mpl_widget.ts b/src/mpl_widget.ts index 06841f2b..81d76c31 100644 --- a/src/mpl_widget.ts +++ b/src/mpl_widget.ts @@ -10,7 +10,7 @@ import { import * as utils from './utils'; -import { MODULE_VERSION } from './version'; +import { MODEL_VERSION } from './version'; import { ToolbarView } from './toolbar_widget'; @@ -30,8 +30,8 @@ export class MPLCanvasModel extends DOMWidgetModel { _view_name: 'MPLCanvasView', _model_module: 'jupyter-matplotlib', _view_module: 'jupyter-matplotlib', - _model_module_version: '^' + MODULE_VERSION, - _view_module_version: '^' + MODULE_VERSION, + _model_module_version: MODEL_VERSION, + _view_module_version: MODEL_VERSION, header_visible: true, footer_visible: true, toolbar: null, diff --git a/src/plugin.ts b/src/plugin.ts index 84ddb45f..a11f697f 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -4,7 +4,7 @@ import { Widget } from '@phosphor/widgets'; import { IJupyterWidgetRegistry } from '@jupyter-widgets/base'; -import { MODULE_NAME, MODULE_VERSION } from './version'; +import { MODEL_VERSION, MODULE_NAME } from './version'; const EXTENSION_ID = 'matplotlib-jupyter:main'; @@ -31,7 +31,7 @@ function activateWidgetExtension( ): void { registry.registerWidget({ name: MODULE_NAME, - version: MODULE_VERSION, - exports: () => import('./index'), + version: MODEL_VERSION, + exports: (): any => import('./index'), }); } diff --git a/src/toolbar_widget.ts b/src/toolbar_widget.ts index b13637fb..48471e2f 100644 --- a/src/toolbar_widget.ts +++ b/src/toolbar_widget.ts @@ -1,6 +1,6 @@ import { DOMWidgetModel, DOMWidgetView } from '@jupyter-widgets/base'; -import { MODULE_VERSION } from './version'; +import { MODEL_VERSION } from './version'; import '../css/mpl_widget.css'; @@ -12,8 +12,8 @@ export class ToolbarModel extends DOMWidgetModel { _view_name: 'ToolbarView', _model_module: 'jupyter-matplotlib', _view_module: 'jupyter-matplotlib', - _model_module_version: '^' + MODULE_VERSION, - _view_module_version: '^' + MODULE_VERSION, + _model_module_version: MODEL_VERSION, + _view_module_version: MODEL_VERSION, toolitems: [], position: 'left', button_style: '', diff --git a/src/version.ts b/src/version.ts index 77ab7589..4f1690b4 100644 --- a/src/version.ts +++ b/src/version.ts @@ -6,10 +6,19 @@ const data = require('../package.json'); * * The html widget manager assumes that this is the same as the npm package * version number. + * + * See counterparts in the _version.py file + * These should not be changed unless we introduce changes to communication between + * frontend and backend. */ -export const MODULE_VERSION = data.version; +export const MODEL_VERSION = '1.0.0'; /* * The current package name. */ export const MODULE_NAME = data.name; + +/* + * The package version + */ +export const MODULE_VERSION = data.version;