From acb603747a4ce2ac57c6d8386fd9129f81e357ba Mon Sep 17 00:00:00 2001 From: Thomas Robitaille Date: Fri, 3 Apr 2020 15:50:14 +0100 Subject: [PATCH] Reduce number of places version is defined --- docs/conf.py | 3 ++- lib/version.js | 1 + lib/wwt.js | 6 ++++-- pywwt/jupyter.py | 5 +++-- 4 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 lib/version.js diff --git a/docs/conf.py b/docs/conf.py index 2e86fd3..b1194f5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -62,7 +62,8 @@ copyright = '2017, ' + author # built documents. # # The short X.Y version. -version = '0.8.0.dev0' +from pywwt import __version__ as version +version = version # The full version, including alpha/beta/rc tags. release = version diff --git a/lib/version.js b/lib/version.js new file mode 100644 index 0000000..d29068f --- /dev/null +++ b/lib/version.js @@ -0,0 +1 @@ +export const version = require('../package.json').version; diff --git a/lib/wwt.js b/lib/wwt.js index b418f0e..e1fca17 100644 --- a/lib/wwt.js +++ b/lib/wwt.js @@ -1,16 +1,18 @@ var widgets = require('@jupyter-widgets/base'); var _ = require("underscore"); +var version = require('./version').version; + var WWTModel = widgets.DOMWidgetModel.extend({ defaults: _.extend(widgets.DOMWidgetModel.prototype.defaults(), { _model_name : 'WWTModel', _model_module : 'pywwt', - _model_module_version : '0.8.0', + _model_module_version : version, _view_name : 'WWTView', _view_module : 'pywwt', - _view_module_version : '0.8.0', + _view_module_version : version, _ra : 0.0, _dec : 0.0, diff --git a/pywwt/jupyter.py b/pywwt/jupyter.py index 8b5115a..6ef0119 100644 --- a/pywwt/jupyter.py +++ b/pywwt/jupyter.py @@ -11,11 +11,12 @@ from ipyevents import Event as DOMListener from .core import BaseWWTWidget from .layers import ImageLayer from .jupyter_server import serve_file +from . import __version__ __all__ = ['WWTJupyterWidget'] -VIEW_MODULE_VERSION = '0.8.0' # synchronize these with lib/wwt.js -MODEL_MODULE_VERSION = '0.8.0' +VIEW_MODULE_VERSION = __version__ +MODEL_MODULE_VERSION = __version__ dom_listener = DOMListener()