Merge pull request #3541 from ivanov/extension-version

basic __version__ reporting for extensions
This commit is contained in:
Matthias Bussonnier 2018-04-17 17:05:34 -07:00 committed by GitHub
commit 8034d71429
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,6 +103,7 @@ def validate_serverextension(import_name, logger=None):
try: try:
mod = importlib.import_module(import_name) mod = importlib.import_module(import_name)
func = getattr(mod, 'load_jupyter_server_extension', None) func = getattr(mod, 'load_jupyter_server_extension', None)
version = getattr(mod, '__version__', '')
except Exception: except Exception:
logger.warning("Error loading server extension %s", import_name) logger.warning("Error loading server extension %s", import_name)
@ -118,7 +119,7 @@ def validate_serverextension(import_name, logger=None):
[logger.info(info) for info in infos] [logger.info(info) for info in infos]
[logger.warn(warning) for warning in warnings] [logger.warn(warning) for warning in warnings]
else: else:
logger.info(post_mortem.format(import_name, "", GREEN_OK)) logger.info(post_mortem.format(import_name, version, GREEN_OK))
return warnings return warnings