A summary of changes in ipywidgets. For more detailed information, see GitHub.
Major user-visible changes in ipywidgets 7.0 include:
- The
Label
widget is now right-aligned and has no width restriction: (#1269) - Using function annotations to specify interact controls for a function is now deprecated and will be removed in a future version of ipywidgets. (#1292)
- Widgets are now displayed in the output area in the classic notebook and are treated as any other output. This allows the widgets to work more naturally with other cell output. To delete a widget, clear the output from the cell. (#1274)
- The Select widget now is a listbox instead of a dropdown, reverting back to the pre-6.0 behavior. (#1238)
- The Select and SelectMultiple widgets now have a
rows
attribute for the number of rows to display, consistent with the Textarea widget. Thelayout.height
attribute overrides this to control the height of the widget. (#1250) - Selection widgets (
Select
,Dropdown
, etc.) now coerce theiroptions
argument to a tuple of(label, value)
pairs. This makes it clearer the order in which the options will be presented. New.value
,.label
, and.index
traits make it easier to observe or access the selected option. (#1262) - The
layout
andstyle
traits can be set with a dictionary for convenience, which will automatically converted to a Layout or Style object. (#1253)IntSlider(layout={'width': '100%'}, style={'handle_color': 'lightgreen'})
- Removed the version validation check since it was causing too many false warnings about the widget javascript not being installed or the wrong version number. It is now up to the user to ensure that the ipywidgets and widgetsnbextension packages are compatible. (#1219)
- Play range is now inclusive (max value is max, instead of max-1), to be consistent with Sliders
Major changes developers should be aware of include:
- The python
@register
decorator for widget classes no longer takes a string argument, but registers a widget class using the_model_*
and_view_*
traits in the class. Using the decorator as@register('name')
is deprecated and should be changed to just@register
. #1228, #1276 - Widgets will now need correct
_model_module
and_view_module
Unicode traits defined. - Custom serializers in Javascript are now synchronous, and should return a snapshot of the widget state. The default serializer makes a copy of JSONable objects. (#1270)
- Selection widgets now sync the index of the selected item, rather than the label. (#1262)
- The widget protocol was significantly overhauled. The new widget messaging protocol (version 2) is specified in the version 2 protocol documentation.
- Custom serializers in either Python or Javascript can now return a structure which contains binary buffers. If a binary buffer is in the serialized data structure, the message will be synced in binary, which is much more efficient. (#1194)
Major user-visible changes in ipywidgets 6.0 include:
-
Rendering of Jupyter interactive widgets in various web contexts
sphinx documentation: http://ipywidgets.readthedocs.io/en/latest/examples/Widget%20List.html nbviewer: http://nbviewer.jupyter.org/github/jupyter-widgets/ipywidgets/blob/master/docs/source/examples/Widget%20List.ipynb Static web pages: http://jupyter.org/widgets
-
Addition of a DatePicker widget in the core widget collection.
-
Changes to the automatic control generation syntax in @interact, inspired by the Sage interact syntax.
-
Removal of APIs which had been deprecated in 5.0, including top-level styling in attributes of DOMWidgets and some corner cases in the behavior of
@interact
. -
A new API for custom styling of widgets is provided, through a top-level
style
attribute. For example, the color of a slider handler can be set byslider.style.handle_color
. -
Removal of the Proxy and PlaceProxy widgets.
-
Removal of the deprecated
FlexBox
widget. Use theBox
,HBox
, orVBox
widgets instead. Various flex properties can be set using thelayout
attribute. -
Removal of the deprecated
Latex
widget. Use the newHTMLMath
widget with Latex math inside$
or$$
delimiters instead. -
Removal of the deprecated layout properties on a widget such as
.width
,.height
, etc. Use thelayout
attribute with aLayout
widget to manage various layout properties instead. -
The
Label
widget now has styling to make it consistent with labels on various widgets. To have freeform text with mathematics, use the newHTMLMath
widget. -
Removal of the
button_style
attribute of the Dropdown widget -
Addition of an OutputWidget for capturing output and rich display objects. @interact has changed to use an OutputWidget for function output instead of overwriting the output area of a cell.
-
The jupyter-js-widgets Javascript implementation now relies on the PhosphorJS framework for the management of rich layout and a better integration of JupyterLab.
-
Numerous bug fixes.
Note for custom widget authors:
ipywidgets 6.0 breaks backward compatibility with respect to the handling of default values of the JavaScript side. Now, the default values for core widget models are specified with a default()
method returning a dictionary instead of a default
dictionary attribute. If you want your library to be backwards compatible with ipywidgets 5.x, you could use _.result like this:
...
defaults: function() {
return _.extend(_.result(this, 'widgets.DOMWidgetModel.prototype.defaults'), {
....
})
},
...
This should not have an impact when using your custom widgets in the classic notebook, but will be really important when deploying your interactive widgets in web contexts.
Bump version with miscellaneous bug fixes.
Add README.rst documentation.
Remove ipynb checkpoints.
First release of ipywidgets as a standalone package.