Skip to content

Commit 3fd3d90

Browse files
committed
Merge remote-tracking branch 'origin/master' into stacklevel
2 parents 0f5268b + 6330485 commit 3fd3d90

35 files changed

+357
-165
lines changed

docs/source/examples/Widget List.ipynb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,6 +1157,28 @@
11571157
")"
11581158
]
11591159
},
1160+
{
1161+
"cell_type": "markdown",
1162+
"metadata": {},
1163+
"source": [
1164+
"## Naive picker\n",
1165+
"\n",
1166+
"In some cases you might want to be able to pick naive datetime objects, i.e. timezone-unaware datetimes. To quote the Python 3 docs:\n",
1167+
"\n",
1168+
"> Naive objects are easy to understand and to work with, at the cost of ignoring some aspects of reality.\n",
1169+
"\n",
1170+
"This is useful if you need to compare the picked datetime to naive datetime objects, as Python will otherwise complain!"
1171+
]
1172+
},
1173+
{
1174+
"cell_type": "code",
1175+
"execution_count": null,
1176+
"metadata": {},
1177+
"outputs": [],
1178+
"source": [
1179+
"widgets.NaiveDatetimePicker(description='Pick a Time')"
1180+
]
1181+
},
11601182
{
11611183
"cell_type": "markdown",
11621184
"metadata": {},

docs/source/migration_guides.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,26 @@ The version of [Backbone.js](https://backbonejs.org/) that ipywidgets depends on
167167
+ }
168168
```
169169

170+
If you were using `.extend()`, you will also need to change how your model attribute defaults are defined. The model defaults are now given by a function that returns the defaults and includes the superclass defaults. For example, the Output widget model [looks like this](https://github.com/jupyter-widgets/ipywidgets/blob/8.0.0/packages/output/src/output.ts):
171+
172+
```javascript
173+
export const OUTPUT_WIDGET_VERSION = '1.0.0';
174+
175+
export class OutputModel extends DOMWidgetModel {
176+
defaults() {
177+
return {
178+
...super.defaults(),
179+
_model_name: 'OutputModel',
180+
_view_name: 'OutputView',
181+
_model_module: '@jupyter-widgets/output',
182+
_view_module: '@jupyter-widgets/output',
183+
_model_module_version: OUTPUT_WIDGET_VERSION,
184+
_view_module_version: OUTPUT_WIDGET_VERSION,
185+
};
186+
}
187+
}
188+
```
189+
170190
#### Custom tag names
171191

172192
If you were changing the base HTML tag for your widget by defining the `tagName` property, this can now be done in ipywidgets 8 in the `preinitialize` method (see [here](https://github.com/jupyter-widgets/ipywidgets/commit/a342e0dbc7c779bb668e5a21c097d7cec9a6ac44) for example changes in core widgets):

docs/source/user_migration_guides.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,6 @@ that inherit `DOMWidget` have the attribute `tooltip` instead.
4040
Suggested migration: Search and replace `description_tooltip` to `tooltip` when you no longer
4141
need to support ipywidgets 7.
4242

43-
#### Selection Widgets
44-
45-
These widgets include: `ToggleButtons`, `Dropdown`, `RadioButtons`, `Select`, `SelectMultiple` `Selection`, `SelectionSlider`, and `SelectionRangeSlider`.
46-
47-
For these, it is no longer possible to use `dict`s or other mapping types as values for the
48-
`options` trait. Using mapping types in this way has been deprecated since version 7.4, and
49-
will now raise a `TypeError`.
50-
51-
Suggested migration: Instead of using a dict `my_dict` as options, use `my_dict.items()`, which returns the items in `my_dict` as key-value pairs. For example, `Select(options=my_dict.items())`.
52-
5343
#### Description Sanitization
5444

5545
The value of the `description` field of any widget that inherits `DescriptionWidget`
@@ -78,6 +68,10 @@ The previously deprecated traits `overflow_x` and `overflow_y`
7868
[have been removed](https://github.com/jupyter-widgets/ipywidgets/pull/2688). Please
7969
use the `overflow` trait instead.
8070

71+
#### `Widget.widgets` and `Widget.widget_types` attributes
72+
73+
The `Widget` class attributes `.widgets` and `.widget_types` are now deprecated and relocated to internal module-level private variables, opening up these attribute names on the `Widget` class for future uses.
74+
8175
### Deployments
8276

8377
#### Embedded CDN

examples/web1/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jupyter-widgets/example-web1",
3-
"version": "8.0.1",
3+
"version": "8.0.2",
44
"private": true,
55
"description": "Project that tests the ability to npm install jupyter-js-widgets within an npm project.",
66
"license": "BSD-3-Clause",
@@ -16,9 +16,9 @@
1616
"test:firefox:headless": "npm run test:default -- --browsers=FirefoxHeadless"
1717
},
1818
"dependencies": {
19-
"@jupyter-widgets/base": "^6.0.0",
20-
"@jupyter-widgets/base-manager": "^1.0.1",
21-
"@jupyter-widgets/controls": "^5.0.0"
19+
"@jupyter-widgets/base": "^6.0.1",
20+
"@jupyter-widgets/base-manager": "^1.0.2",
21+
"@jupyter-widgets/controls": "^5.0.1"
2222
},
2323
"devDependencies": {
2424
"chai": "^4.0.0",

examples/web2/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jupyter-widgets/example-web2",
3-
"version": "8.0.1",
3+
"version": "8.0.2",
44
"private": true,
55
"description": "Project that tests the ability to npm install jupyter-js-widgets within an npm project.",
66
"license": "BSD-3-Clause",
@@ -13,9 +13,9 @@
1313
"test:default": "echo \"No test specified\""
1414
},
1515
"dependencies": {
16-
"@jupyter-widgets/base": "^6.0.0",
17-
"@jupyter-widgets/base-manager": "^1.0.1",
18-
"@jupyter-widgets/controls": "^5.0.0",
16+
"@jupyter-widgets/base": "^6.0.1",
17+
"@jupyter-widgets/base-manager": "^1.0.2",
18+
"@jupyter-widgets/controls": "^5.0.1",
1919
"codemirror": "^5.48.0",
2020
"font-awesome": "^4.7.0"
2121
},

examples/web3/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jupyter-widgets/example-web3",
3-
"version": "8.0.2",
3+
"version": "8.0.3",
44
"private": true,
55
"description": "Project that tests the ability to npm install jupyter-js-widgets within an npm project.",
66
"license": "BSD-3-Clause",
@@ -14,9 +14,9 @@
1414
"test:default": "echo \"No test specified\""
1515
},
1616
"dependencies": {
17-
"@jupyter-widgets/base": "^6.0.0",
18-
"@jupyter-widgets/controls": "^5.0.0",
19-
"@jupyter-widgets/html-manager": "^1.0.2",
17+
"@jupyter-widgets/base": "^6.0.1",
18+
"@jupyter-widgets/controls": "^5.0.1",
19+
"@jupyter-widgets/html-manager": "^1.0.3",
2020
"@jupyterlab/services": "^6.0.0",
2121
"codemirror": "^5.48.0",
2222
"font-awesome": "^4.7.0",

examples/web4/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jupyter-widgets/example-web4",
3-
"version": "8.0.2",
3+
"version": "8.0.3",
44
"private": true,
55
"description": "Project that tests the ability to npm install jupyter-js-widgets within an npm project.",
66
"license": "BSD-3-Clause",
@@ -13,7 +13,7 @@
1313
"test:default": "echo \"No test specified\""
1414
},
1515
"dependencies": {
16-
"@jupyter-widgets/html-manager": "^1.0.2",
16+
"@jupyter-widgets/html-manager": "^1.0.3",
1717
"font-awesome": "^4.7.0"
1818
},
1919
"devDependencies": {

packages/base-manager/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jupyter-widgets/base-manager",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "Jupyter interactive widgets - base manager",
55
"repository": {
66
"type": "git",
@@ -32,7 +32,7 @@
3232
"test:unit:ie": "npm run test:unit:default -- --browsers=IE"
3333
},
3434
"dependencies": {
35-
"@jupyter-widgets/base": "^6.0.0",
35+
"@jupyter-widgets/base": "^6.0.1",
3636
"@jupyterlab/services": "^6.0.0",
3737
"@lumino/coreutils": "^1.11.1",
3838
"base64-js": "^1.2.1",

packages/base/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@jupyter-widgets/base",
3-
"version": "6.0.0",
3+
"version": "6.0.1",
44
"description": "Jupyter interactive widgets",
55
"repository": {
66
"type": "git",

packages/base/src/errorwidget.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { BROKEN_FILE_SVG_ICON } from './utils';
99

1010
// create a Widget Model that captures an error object
1111
export function createErrorWidgetModel(
12-
error: Error,
12+
error: unknown,
1313
msg?: string
1414
): typeof WidgetModel {
1515
class ErrorWidget extends DOMWidgetModel {
@@ -78,12 +78,15 @@ export class ErrorWidgetView extends DOMWidgetView {
7878
}
7979

8080
export function createErrorWidgetView(
81-
error?: Error,
81+
error?: unknown,
8282
msg?: string
8383
): typeof WidgetView {
8484
return class InnerErrorWidgetView extends ErrorWidgetView {
8585
generateErrorMessage(): { msg?: string; stack: string } {
86-
return { msg, stack: String(error?.stack) };
86+
return {
87+
msg,
88+
stack: String(error instanceof Error ? error.stack : error),
89+
};
8790
}
8891
};
8992
}

0 commit comments

Comments
 (0)