This is a summary of changes in ipywidgets releases. For more detailed information, see the issues and pull requests for the appropriate milestone on GitHub.
Highlights include:
-
Fix: registry state lookup failed, making is impossible to create widgets from the frontend: #3653
8.0.3
Highlights include:
- Fix: be backwards compatibel with 7.x, where we re-instroduced
.widget
and.widget_types
#3567 - Fix: be backwards compatibel with 7.x, revert hold_sync during set_state #3642
To see the full list of pull requests and issues, see the 8.0 milestone on GitHub, or the full list of changes since 7.x. See the user migration guide for suggestions about migrating your code that uses ipywidgets to 8.0. If you author a custom widget, please see the custom widget migration guide for suggestions about migrating your widget to support ipywidgets 8.
Here are some highlights of user-visible changes in ipywidgets 8.0.
In addition to the existing DatePicker widget, we now have new DatetimePicker and TimePicker widgets. (#2715)
from ipywidgets import VBox, TimePicker, DatetimePicker
VBox([
TimePicker(description='Time'),
DatetimePicker(description='Date/Time')
])
The new TagsInput widget provides an easy way to collect and manage tags in a widget. You can drag and drop tags to reorder them, limit them to a set of allowed values, or even prevent making duplicate tags. (#2591, #3272)
from ipywidgets import TagsInput
TagsInput(
value=['pizza', 'fries'],
allowed_tags=['pizza', 'fries', 'tomatoes', 'steak'],
allow_duplicates=False
)
Similarly, the new ColorsInput widget provides a way to select colors as tags
from ipywidgets import ColorsInput
ColorsInput(
value=['red', '#2f6d30'],
# allowed_tags=['red', 'blue', 'green'],
# allow_duplicates=False
)
The new Stack container widget shows only the selected child widget, while other child widgets remain hidden. This can be useful if you want to have a area that displays different widgets depending on some other interaction.
from ipywidgets import Stack, Button, IntSlider, Dropdown, VBox, link
s = Stack([Button(description='Click here'), IntSlider()], selected_index=0)
d = Dropdown(options=['button', 'slider'])
link((dropdown, 'index'), (stacked, 'selected_index'))
VBox([d, s])
The file upload widget has been overhauled to handle multiple files in a more useful format:
- The
.value
attribute is now a list of dictionaries, rather than a dictionary mapping the uploaded name to the content. - The contents of each uploaded file is a memory view in the
.content
key, e.g.,uploader.value[0].content
. - The
.data
attribute has been removed. - The
.metadata
attribute has been removed.
See the user migration guide for details on how to migrate your code.
Many style and layout options have been added to core widgets:
- Tooltips are now supported for many core widgets, rather than just a few description tooltips (#2680)
from ipywidgets import Button Button(description="Click me", tooltip='An action')
- Borders can be styled independently with the layout's
border_top
,border_right
,border_bottom
,border_left
attributes (#2757, #3269)from ipywidgets import Button Button(description="Click me", layout={'border_bottom': '3px solid blue'})
- Descriptions are now plain text by default for security, but you can set them to allow HTML with the
description_allow_html
attribute (HTML content is still sanitized for security). (#2785)from ipywidgets import Text Text(description="<b>Name</b>", description_allow_html=True)
- Many other styling attributes can be set on core widgets, such as font family, size, style, weight, text color, and text decoration. See the table in the documentation for a reference. (#2728)
- The SelectionSlider now has a
handle_color
style attribute (#3142) - To control keyboard navigation, widgets can be set to be tabbable or not (i.e., that the tab key will traverse to the widget) (#2640)
The Accordion, Tab, and Stack widgets now have a .titles
attribute that you can use to get and set titles from the constructor or as an attribute. (#2746, #3296, #3477)
from ipywidgets import Tab, IntSlider, Text
Tab([IntSlider(), Text()], titles=('Slider', 'Text'))
The slider implementation in the core widgets now uses nouislider. This enables us to fix long-standing bugs and introduce new features, like dragging the range in a RangeSlider. (#2712, #630, #3216, #2834)
By default, ipywidgets 8 enables a collaboration mode, where widget updates from one frontend are reflected back to other frontends, enabling a consistent state between multiple users and fixing synchronization between the kernel and frontend. You may want to disable these update echo messages if they are using too much bandwidth or causing slower interactivity. To disable echo update messages across ipywidgets, set the environment variable JUPYTER_WIDGETS_ECHO
to 0
. For widget authors, to opt a specific attribute of custom widget out of echo updates (for example, if the attribute contains a lot of data that does not need to be synchronized), tag the attribute with echo_update=False
metadata (we do this in core for the FileUpload widget's data
attribute). (#3195, #3343, #3394, #3407)
We have made it easier to load widgets from content delivery networks.
- The default CDN is changed from unpkg to jsDelivr (#3121, #1627)
- You can use the
data-jupyter-widgets-cdn-only
attribute to load modules only from CDN (#2792, #2786) - We have updated the webpack public path settings so the HTMLManager and the Jupyter Notebook extensions pull assets from wherever they are loaded, rather than only from CDN. If you author a custom widget, we highly encourage you to apply similar changes to your widget by adapting the changes at https://github.com/jupyter-widgets/widget-cookiecutter/pull/103/files. #3464, #3508
Here is a short list of some of the other changes in ipywidgets 8.0.
- Add a cookiecutter-based tutorial to build a custom widget (#2919)
- Change media widgets to use memory views. (#2723)
- Upgrade to FontAwesome 5 in html-manager (#2713)
- Play widget now toggles between play and pause button as needed (#2703, #2671)
- Drop support for mapping types as selection options (#2679, #1958)
- Focus or blur a widget. (#2664, #2692, #2691, #2690)
- Drop notebook dependency from widgetsnbextension (#2590)
- Cast 'value' in range sliders to a tuple (#2441)
- Play widget: expose playing and repeat (#2283, #1897)
- Fix debouncing and throttling code (#3060)
- Fix regression on spinning icons (#2685, #2477)
- Fix selection container default index (#1823)
- Remove deprecated overflow properties (#2688)
- Select: Do not force a selection if there is currently no selection and the options list changes (#3284)
- Add support for localization to the lab extension (#3286)
- Drop support for Python 2.7, 3.4, and 3.5 (#2558, #2655, #3131, #3120)
- Fix character escapes in combobox options (#2972)
- Modify outputs to use a comm if IPython is not available (#2954)
- Bugfix/parameters in the from_file method to be passed along in the media class (#3074)
- Widgetsnbextension: throw error on failure to render (#3280)
- Fix memory leak from Image widget not releasing object urls (#3171, #3170)
- ErrorWidget as fallback when widgets models or views fail - Following up (#3304)
- Fix matplotlib plots in interact (#3277)
- Fix selection equality checking (#2897)
- Remove the
on_displayed
Python callback mechanism (#2021)
To see an overview of the changes to the core widget model specification, see #3455.
Widget.widgets
andWidget.widget_types
are now private variables (#3122, #3173)- Generate the widget data spec as JSON (#2193)
- Use
_repr_mimebundle_
and require ipython 6.1 or later. (#2021, #1811) - Hold sync during
set_state
+ fix selection widgets flakiness (#3271) - Remove deprecated
handle_kernel
alias (#2694) - Removed deprecated signature of the
register
decorator (#2695)
- Fix CSS variable names to match JupyterLab names (#2801, #2062)
- Delete
display_model
anddisplay_view
(#2752, #2751) - Drop underscore usage (#2742)
- Upgrade to es2017 javascript (#2725)
- Split base manager into separate packages (#2710, #2561)
- Change Phosphor to Lumino (#2681, #3267)
- Widgetmanagerbase: improve create_view return type (#2662)
- Refactor the JupyterLab widget manager so it can be reused (#2532)
- Make more of lab manager dependencies optional (#2528)
- Remove class
jupyter-widgets
fromjp-outputarea-output
node (#2500) - Rename
pWidget
toluminoWidget
and deprecatepWidget
(#3118, #3141, #3358,) - Add
layout
,style
, andshown
events (#3300) - Implement
jupyter.widget.control
comm channel (#3313) - Update to TypeScript 4.3 (#3162)
- Add event listener for resize events (#3124)
- Remove
process.cwd
polyfill (#3315) - Make sure buffer is a DataView (#3127)
- Deprecate the overly broad CSS class
widget
and introduce a similarjupyter-widget
CSS class (#3146) - Fetch the full widget state via a control Comm (#3021)
- Export LabWidgetManager and KernelWidgetManager (#3166)
- More helpful semver range message (#3185)
- Make the base widget manager
.get_model()
method always return a Promise, which is rejected if the requested model is not registered. To test if a model is registered, use the new.has_model()
method (#3389)
- Documentation overhaul (#3104, #3096, #3099, #3076, #2824, #3246, #3243, #3103, #3165, #3283, #2927, #3062, #3129, #3130, #3155, )
- Remove step parameter from widget list notebook (#3106)
- Remove extra requirements from doc to fix RTD build (#3098)
- Align doc requirements for 7.x branch with master (#3094)
- Remove defunct deep-links from install in README (#3225)
- Fix documentation about embedding widget in HTML (#3224)
- Fix example web3 missing process during runtime (#3223)
- Complete docstring for
interactive
. (#3169) - Unpin ipykernel<6 for the docs (#3168)
- Checking milestone and generating changelog (#3125)
- Change graph example to receive a tuple instead of a dict (#3117)
- Fix debouncing and throttling code (#3060)
- Variable Inspector example used a wrong callback argument signature (#3302)
- Visual regression testing using Galata (#3172, #3279)
- Reorganize packages in the monorepo, moving the python packages to the
python
folder (#3301, #3316) - Use new custom widget label on issue template (#3176)
- Create and upload reference screenshots on CI failure (#3227)
- Allow generate-spec to take optional output file (#3174)
- Update to Jupyter Packaging 0.10 (#3194)
- Update bug report test environment (#3156)
- Create links out to gitter and discourse from the new issue options (#3153)
- Adapt the milestone_check script from JupyterLab for ipywidgets. (#3091)
- Fix spec generation for traitlets 5 (#3234)
- Add documentation issue template (#3095)
- Add Binder links and badges (#3164, #3212, #3151, #3148, #2701)
(GitHub contributors page for this release)
@afonit | @alex-rind | @Alexboiboi | @azjps | @blois | @bollwyvl | @bsyouness | @casperdcl | @crahan | @davidbrochart | @deisi | @dependabot | @elliothershberg | @fperez | @giswqs | @github-actions | @hai-schrodinger | @ianhi | @ibdafna | @jasongrout | @jbpauly | @joequant | @joseph2rs | @jpn-- | @jtpio | @keatonb | @kedarisetti | @kefirbandi | @maartenbreddels | @manuvazquez | @marimeireles | @MartinKolarik | @martinRenou | @mbektas | @meeseeksdev | @meeseeksmachine | @mgeier | @MicaelJarniac | @minrk | @MSeal | @mwcraig | @NichtJens | @nmstoker | @partev | @pbugnion | @raziqraif | @rsheftel | @shaperilio | @smeng9 | @snickell | @StefanBrand | @stonebig | @SylvainCorlay | @thomasaarholt | @trungleduc | @vidartf | @willingc | @zerline
To see the full list of pull requests, see the 7.7.1 milestone on GitHub.
Highlights include:
-
Fix broken link icon for FontAwesome 4 and 5 #3495
-
Fix message throttling bug #3494
-
Fix state message parsing to be more permissive #3486
-
Fix tests on Python 3.11 #3480
-
Add better front-page docs #3496
7.7
To see the full list of pull requests and issues, see the 7.7 milestone on GitHub.
Highlights include:
- Fix installation on Python 3.10. #3368
- Throw an error if we cannot render a widget, enabling the rendering system to fall back to rendering a different data type if available. #3290
- Create a new widget control comm channel, enabling more efficient fetching of kernel widget state. #3201
- Refactor logic for fetching kernel widget state to the manager base class. This logic first tries to use the new widget control comm channel, falling back to the existing method of requesting each widget's state individually. #3337
- Enable HTMLManager output widgets to render state updates. #3372
- Do not reset JupyterLab CSS variables if they are already defined. #3344
- Fix variable inspector example. #3302
- Introduce new widget manager
has_model
method for synchronously checking if a widget model is registered. #3377 - Work around bug in Chrome rendering Combobox arrows. #3375
- Optionally echo update messages from frontends to other frontends. This enables widget views in different frontends to maintain consistent state simultaneously, and also makes sure that simultaneous updates from the kernel and frontend resolve to a consistent state. This is off by default in ipywidgets 7.7, and it is anticipated this will be on by default in ipywidgets 8.0. To enable echo update messages across ipywidgets, set the environment variable
JUPYTER_WIDGETS_ECHO
to 1. To opt a specific attribute out of echo updates, tag the attribute withecho_update=False
metadata (we do this in core for the FileUpload widget'sdata
attribute). #3400, #3394
To see the full list of pull requests and issues, see the 7.6.0 milestone on GitHub.
The main change in this release is that installing ipywidgets
7.6.0 will now automatically enable ipywidgets support in JupyterLab 3.0—a user has no extra JupyterLab installation step and no rebuild of JupyterLab, nor do they need Node.js installed. Simply install the python ipywidgets package with pip (pip install ipywidgets==7.6.0
) or conda/mamba (conda install -c conda-forge ipywidgets=7.6.0
) and ipywidgets will automatically work in classic Jupyter Notebook and in JupyterLab 3.0.
This is accomplished with the new python package jupyterlab_widgets
version 1.0, on which ipywidgets
7.6.0 now depends (similar to how ipywidgets
already depends on the widgetsnbextension
package to configure ipywidgets for the classic Jupyter Notebook). The jupyterlab_widgets
Python package is a JupyterLab 3.0 prebuilt extension, meaning that it can be installed into JupyterLab 3.0 without rebuilding JupyterLab and without needing Node.js installed.
Custom widget maintainers will need to make two changes to update for JupyterLab 3:
-
Update the
@jupyter-widgets/base
dependency version to include^4
to work in JupyterLab 3.0. For example, if you had a dependency on@jupyter-widgets/base
version^2 || ^3
, update to^2 || ^3 || ^4
for your widget to work in classic Jupyter Notebook, JupyterLab 1, JupyterLab 2, and JupyterLab 3. See #2472 for background. -
In the
package.json
, add the followingsharedPackages
configuration inside thejupyterlab
key. See the JupyterLab extension documentation for more information."jupyterlab": { "sharedPackages": { "@jupyter-widgets/base": { "bundled": false, "singleton": true } } }
Separate from these two steps to update for JupyterLab 3, we also recommend that you make your widget's JupyterLab extension a prebuilt extension for JupyterLab 3.0. Users will be able to install your JupyterLab 3.0 prebuilt extension without rebuilding JupyterLab or needing Node.js. See the JupyterLab 3 extension developer documentation or the new widget extension cookiecutter for more details.
To see the full list of pull requests and issues, see the 7.5 milestone on GitHub.
Changes include:
- New
AppLayout
andGridLayout
templates for positioning interactive widgets. #2333 - New
FileUpload
widget allowing users to upload files from the browser. #2258 - New
ComboBox
widget. #2390 - JupyterLab CSS variables are now exposed by default even in the case of the classic notebook. #2418
Custom widget maintainers will need to update their @jupyter-widgets/base
dependency version to work in JupyterLab 1.0. For example, if you had a dependency on @jupyter-widgets/base
version ^1.1
, update to ^1.1 || ^2
for your widget to work in classic notebook, JupyterLab 0.35, and JupyterLab 1.0. See #2472 for background.
To see the full list of pull requests and issues, see the 7.4 milestone on GitHub.
Changes include:
- New
Video
andAudio
widgets have been introduced. #2162 We updated the@jupyter-widgets/controls
widget specification version to1.4.0
, leading to the version bump to 7.4. - The use of mappings for the
options
attribute of selection widgets is deprecated. #2130
To see the full list of pull requests and issues, see the 7.3 milestone on GitHub.
Changes include:
-
A new
GridBox
widget is introduced and associated CSS grid properties are added to the layout. This enables using the CSS Grid spec for laying out widgets. See the Widget Styling documentation for some examples. Because of this and other model specification changes, the view and module versions of widgets was incremented in both the base and controls packages. (#2107, #2064, #1942) -
Widgets with a
description
attribute now also have adescription_tooltip
attribute to set a tooltip on the description. The tooltip defaults to the description text. Settingdescription_tooltip
to''
removes it, and setting it toNone
makes the tooltip default to the description text. (#2070) -
'transparent'
is now a valid color for color attributes. (#2128) -
Dropdowns now have extra padding to make room for the dropdown arrow. (#2052, #2101)
-
Image widget
repr
now truncates the image value to prevent huge amounts of output in notebooks. (#2111) -
Python 3.3 support is dropped. Python 3.3 support was dropped in the Python community in September 2017. (#2129)
-
The license information has been consolidated into the LICENSE file, and the COPYING.md file is removed. If you are repackaging ipywidgets or widgetsnbextension, please make sure to include LICENSE instead of COPYING.md. (#2133, #2048, #1701, #1706)
To see the full list of pull requests and issues, see the 7.2 milestone on GitHub.
User-visible changes include:
-
A new
FloatLogSlider
widget is a slider with a log scale, suitable for exploring a wide range of magnitudes. (#1928, #2014)from ipywidgets import FloatLogSlider FloatLogSlider()
-
link
anddlink
are now exported from ipywidgets for convenience, so that you can import them directly from ipywidgets instead of needing to import them from traitlets. (#1923) -
A new option
manual_name
has been added tointeract_manual()
to change the name of the update button, for exampleinteract_manual(manual_name='Update')
. (#1924) -
The Output widget now has a
.capture()
method, which returns a decorator to capture the output of a function.from ipywidgets import Output out = Output() @out.capture() def f(): print('This output is captured')
The
.capture()
method has aclear_output
boolean argument to automatically clear the output every time the function is run, as well as await
argument corresponding to theclear_output
wait argument. (#1934) -
The Output widget has much more comprehensive documentation in its own section. (#2020)
-
Installing
widgetsnbextension
now automatically enables the nbextension in Jupyter Notebook 5.3 or later. (#1911) -
The default rendering of a widget if widgets are not installed is now a short description of the widget in text instead of a much longer HTML message. (#2007)
Changes for developers include:
- The JavaScript base widget manager class now has a
resolveUrl
method to resolve a URL relative to the current notebook location. (#1993) - The html manager now exposes a way to specify which JavaScript file is fetched for a package and the loader used to fetch the library. (#1995, #1998)
- The
@jupyter-widgets/controls
widget specification version was bumped to1.2.0
. Changes include the FloatLogSlider widget and more specific documentation about array element types. (#2017)
To see the full list of pull requests and issues, see the 7.1 milestone on GitHub.
We updated the @jupyter-widgets/controls
widget specification version to 1.1.0
, leading to the version bump to 7.1. The new widget model specification now includes new description_width
and font_weight
attributes for the ToggleButtonsStyle
widget. There are also other bugfixes in this release.
See the GitHub milestones for the 7.0.1, 7.0.2, 7.0.3, 7.0.4, and 7.0.5 releases for bugfixes in these releases.
To see the full list of pull requests and issues, see the 7.0 milestone on GitHub.
Major user-visible changes in ipywidgets 7.0 include:
- 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. Output from functions triggered by a widget view is appended to the output area that contains the widget view. This means that printed text will be appended to the output, and calling
clear_output()
will delete the entire output, including the widget view. (#1274, #1353) - 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)
- The documentation theme is changed to the new standard Jupyter theme. (#1363)
- The
layout
andstyle
traits can be set with a dictionary for convenience, which will automatically converted to a Layout or Style object, likeIntSlider(layout={'width': '100%'}, style={'handle_color': 'lightgreen'})
. (#1253) - 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
,ToggleButtons
, etc.) have new.value
,.label
, and.index
traits to make it easier to access or change the selected option. (#1262, #1513) - Selection container widgets (
Accordion
,Tabs
) can have their.selected_index
set toNone
to deselect all items. (#1495) - The
Play
widget range is now inclusive (max value is max, instead of max-1), to be consistent with Sliders - The
Play
widget now has an optional repeat toggle button (visible by default). (#1190) - A refactoring of the text, slider, slider range, and progress widgets in resulted in the progress widgets losing their
step
attribute (which was previously ignored), and a number of these widgets changing their_model_name
and/or_view_name
attributes (#1290) - The
Checkbox
description is now on the right of the checkbox and is clickable. TheCheckbox
widget has a newindent
attribute (defaults toTrue
) to line up nicely with controls that have descriptions. To make the checkbox align to the left, setindent
toFalse
. (#1346) - A new Password widget, which behaves exactly like the Text widget, but hides the typed text:
Password()
. (#1310) - A new SelectionRangeSlider widget for selecting ranges from ordered lists of objects. For example, this enables having a slider to select a date range. (#1356)
- The
Label
widget now has no width restriction. (#1269) - The description width is now configurable with the
.style.description_width
attribute (#1376) - ToggleButtons have a new
.style.button_width
attribute to set the CSS width of the buttons. Set this to'initial'
to have buttons that individually size to the content width. (#1257) - The
readout_format
attribute of number sliders now validates its argument. (#1550) - The
IntRangeSlider
widget now has a.readout_format
trait to control the formatting of the readout. (#1446) - The
Text
,Textarea
,IntText
,BoundedIntText
,FloatText
, andBoundedFloatText
widgets all gained acontinuous_update
attribute (defaults toTrue
forText
andTextArea
, andFalse
for the others). (#1545) - The
IntText
,BoundedIntText
,FloatText
, andBoundedFloatText
widgets are now rendered as HTML number inputs, and have astep
attribute that controls the resolution. (#1545) - The
Text.on_submit
callback is deprecated; instead, setcontinuous_update
toFalse
and observe thevalue
attribute:mywidget.observe(callback, 'value')
. TheTextarea.scroll_to_bottom
method was removed. (#1545) - The
msg_throttle
attribute on widgets is now gone, and the code has a hardcoded message throttle equivalent tomsg_throttle=1
. (#1557) - Using function annotations to specify interact controls for a function is now deprecated and will be removed in a future version of ipywidgets. (#1292)
- There are now two simple ways to embed widgets in an HTML page: with a simple script tag that does not use require.js and does not support anything but the basic widgets, and a require module that does support custom widgets. See the migration guide for more details. (#1615, #1629, #1630)
If you are developing a custom widget or widget manager, here are some major changes that may affect you. The migration guide also walks through how to upgrade a custom widget.
- On the Python/kernel side:
- 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. - Selection widgets now sync the index of the selected item, rather than the label. (#1262)
- The Python
ipywidget.domwidget.LabeledWidget
is nowipywidget.widget_description.DescriptionWidget
, and there is a newipywidget.widget_description.DescriptionStyle
that lets the user set the CSS width of the description. - Custom serializers can now return a structure that contains binary objects (
memoryview
,bytearray
, or Python 3bytes
object). In this case, the sync message will be a binary message, which is much more efficient for binary data than base64-encoding. The Image widget now uses this binary synchronization. (#1194, #1595, #1643)
- The Python
- On the Javascript side:
- The
jupyter-js-widgets
Javascript package has been split into@jupyter-widgets/base
package (containing base widget classes, the DOM widget, and the associated layout and style classes), and the@jupyter-widgets/controls
package (containing the rest of the Jupyter widgets controls). Authors of custom widgets will need to update to depend on@jupyter-widgets/base
instead ofjupyter-js-widgets
(if you use a class from the controls package, you will also need to depend on@jupyter-widgets/controls
). See the cookie cutter to generate a simple example custom widget using the new packages. - 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)
- Custom serializers can now return a structure that contains binary objects (
ArrayBuffer
,DataView
, or a typed array such asInt8Array
,Float64Array
, etc.). In this case, the sync message will be a binary message, which is much more efficient for binary data than base64-encoding. The Image widget now uses this binary synchronization. (#1194, #1643) - A custom serializer is given the widget instance as its second argument, and a custom deserializer is given the widget manager as its second argument.
- The Javascript model
.id
attribute has been renamed to.model_id
to avoid conflicting with the Backbone.id
attribute. (#1410)
- The
- Regarding widget managers and the syncing message protocol:
- The widget protocol was significantly overhauled. The new widget messaging protocol (version 2) is specified in the version 2 protocol documentation.
- Widgets are now displayed with a
display_data
message instead of with a custom comm message. See the ipywidgets implementation for an example. (#1274) - Custom widget managers are now responsible completely for loading widget model and view classes. Widget managers should provide an output model and view class appropriate for their environment so that the
Output
widget works. (#1313) - The widget manager
clear_state
method no longer has acommlessOnly
argument. All models in the widget manager will be closed and cleared whenclear_state
is called. (#1354)
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/main/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.