matplotlib / matplotlib/ipympl

DeprecationWarning with traitlets when using %matplotlib widget

Open
#236 1 comment 4 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
1.7k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

## Describe the issue

It seems that the widget backend is doing something that is deprecated, and I thought I should make a note of it here.
Example:
```python
import warnings
import matplotlib.pyplot as plt

%matplotlib widget
warnings.simplefilter("always", DeprecationWarning)
plt.subplots()
```
I get the following warnings
```python-trace
/home/maij/.local/lib/python3.6/site-packages/ipywidgets/widgets/widget.py:412: DeprecationWarning: Passing unrecoginized arguments to super(Canvas).__init__().
__init__() missing 1 required positional argument: 'figure'
This is deprecated in traitlets 4.2.This error will be raised in a future release of traitlets.
super(Widget, self).__init__(**kwargs)
/home/maij/.local/lib/python3.6/site-packages/ipywidgets/widgets/widget.py:412: DeprecationWarning: Passing unrecoginized arguments to super(Toolbar).__init__().
__init__() missing 1 required positional argument: 'canvas'
This is deprecated in traitlets 4.2.This error will be raised in a future release of traitlets.
super(Widget, self).__init__(**kwargs)
```
## Versions

```
3.6.9 (default, Apr 18 2020, 01:56:04)
[GCC 8.4.0]
ipympl version: 0.5.6
jupyter core : 4.6.3
jupyter-notebook : 6.0.3
qtconsole : 4.7.4
ipython : 7.13.0
ipykernel : 5.2.0
jupyter client : 6.1.3
jupyter lab : 2.1.4
nbconvert : 6.0.0a0
ipywidgets : 7.5.1
nbformat : 5.0.4
traitlets : 4.3.3
JupyterLab v2.1.4
Known labextensions:
app dir: /usr/local/share/jupyter/lab
@jupyter-widgets/jupyterlab-manager v2.0.0 enabled OK
@jupyter-widgets/jupyterlab-sidecar v0.5.0 enabled OK
jupyter-matplotlib v0.7.2 enabled OK
shared_kernel v0.1.0 enabled OK
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the warning with the supplied Python snippet and the `%matplotlib widget` backend, then trace the Canvas and Toolbar initialization mentioned in the traceback. Compare behavior with the listed ipympl, ipywidgets, and traitlets versions; done means the example no longer emits these DeprecationWarning messages and the behavior is covered by an appropriate regression check.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.