From ca2f5b763328c3592a4790cf406a8cac70c936ea 2014-12-15 16:13:59 From: Matthias Bussonnier Date: 2014-12-15 16:13:59 Subject: [PATCH] Merge pull request #7204 from jasongrout/widget-warning2 Make the widget warning brief and easy to filter --- diff --git a/IPython/html/widgets/__init__.py b/IPython/html/widgets/__init__.py index 9480d95..cb47420 100644 --- a/IPython/html/widgets/__init__.py +++ b/IPython/html/widgets/__init__.py @@ -24,6 +24,15 @@ from .widget_selection import RadioButtonsWidget, ToggleButtonsWidget, DropdownW from .widget_selectioncontainer import TabWidget, AccordionWidget from .widget_string import HTMLWidget, LatexWidget, TextWidget, TextareaWidget -# Warn on import -from warnings import warn -warn("IPython widgets are experimental and may change in the future.", FutureWarning, stacklevel=2) +# We use warn_explicit so we have very brief messages without file or line numbers. +# The concern is that file or line numbers will confuse the interactive user. +# To ignore this warning, do: +# +# from warnings import filterwarnings +# filterwarnings('ignore', module='IPython.html.widgets') + +from warnings import warn_explicit +__warningregistry__ = {} +warn_explicit("IPython widgets are experimental and may change in the future.", + FutureWarning, '', 0, module = 'IPython.html.widgets', + registry = __warningregistry__, module_globals = globals)