Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit deprecation warning on old name #411

Merged
merged 1 commit into from
Feb 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion jupyter_server/extension/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import importlib
import warnings


class ExtensionLoadingError(Exception):
Expand Down Expand Up @@ -28,6 +29,11 @@ def get_loader(obj, logger=None):
func = getattr(obj, '_load_jupyter_server_extension')
except AttributeError:
func = getattr(obj, 'load_jupyter_server_extension')
warnings.warn("A `_load_jupyter_server_extension` function was not "
"found in {name!s}. Instead, a `load_jupyter_server_extension` "
"function was found and will be used for now. This function "
"name will be deprecated in future releases "
"of Jupyter Server.".format(name=obj), DeprecationWarning)
except Exception:
raise ExtensionLoadingError("_load_jupyter_server_extension function was not found.")
return func
Expand Down Expand Up @@ -92,4 +98,4 @@ def validate_extension(name):
If this works, nothing should happen.
"""
from .manager import ExtensionPackage
return ExtensionPackage(name=name)
return ExtensionPackage(name=name)