FigureWidget + go.Image.source breaks notebook kernel in VSCode
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 18.8k
- Fork
- 2.8k
- Merge trung bình
- 16 giờ 26 phút
- Pull request đã merge (30 ngày)
- 21
Mô tả
I encounter a bug in VSCode notebook when using a FigureWidget for a go.Image trace using source string instead of z attribute (px.imshow optimization).
The bug is: once you hover the image with mouse the kernel is unresponsive, i.e. you can't run any cell anymore.
The bug is not present when running the notebook through Jupyter web interface.
Reproducible example
import numpy as np
import plotly.express as px
import plotly.graph_objects as go
from plotly.utils import image_array_to_data_uri
img = (np.random.rand(10, 10, 3) * 255).astype(np.uint8)
img_str = image_array_to_data_uri(img)
# --- Using normal go.Figure is OK
# px.imshow(img) # OK
# go.Figure(go.Image(z=img)) # OK
# go.Figure(go.Image(source=img_str)) # OK
# --- Using go.FigureWidget and Image.z is OK
# go.FigureWidget(go.Image(z=img)) # OK
# --- Using go.FigureWidget and Image.source is NOT OK
# go.FigureWidget(px.imshow(img)) # NOK
go.FigureWidget(go.Image(source=img_str)) # NOK
Versions
$ conda list | grep -E 'plotly|ipykernel|pillow|numpy|pandas'
ipykernel 6.26.0 pyhf8b6a83_0 conda-forge
numpy 1.26.0 py312heda63a1_0 conda-forge
pandas 2.1.3 py312hfb8ada1_0 conda-forge
pillow 10.1.0 py312hf3581a9_0 conda-forge
plotly 5.18.0 pyhd8ed1ab_0 conda-forge
$ code --version
1.84.2
1a5daa3a0231a0fbba4f14db7ec463cf99d7768e
x64
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Tái hiện ví dụ FigureWidget được cung cấp trong notebook VSCode, so sánh go.Image(source=...) với go.Image(z=...) và lần chạy web tương đương của Jupyter. Theo dõi tương tác của notebook FigureWidget được kích hoạt khi di chuột qua hình ảnh dựa trên source; issue được hoàn tất khi việc di chuột không còn khiến kernel không phản hồi và việc thực thi ô bình thường tiếp tục.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- jupyter-notebook, python, vscode
- Lĩnh vực
- data-visualization, frontend
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100