Circular Import Dependency in Plotly Templates
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- python
調査の方向性
plotly==5.24.1 と plotly-resampler==0.10.0 で失敗を再現し、その後 plotly.graph_objs.init.py と layout/template/data/_heatmapgl.py を調査します。報告された FigureResampler の例からインポート順序を追跡します。例が、事前に手動で plotly.graph_objs をインポートしなくても図をインポートして構築できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
The issue is that plotly's template system has a circular import dependency:
plotly.graph_objs.__init__.pyimports all trace types including Heatmapgl- During this import process, it also loads template data
layout/template/data/_heatmapgl.pytries toimport Heatmapgl from plotly.graph_objs- But plotly.graph_objs is still in the process of being imported!
This occurred when attempting to use plotly and plotly-resampler and a heatmap.
Reproduction of Error
Minimal reproduction code:
import plotly.graph_objs as go
go.Heatmapgl() # ✅ Success
# But this fails:
from plotly_resampler import FigureResampler
fig = FigureResampler(go.Figure()) # ❌ Circular import
Versions affected:
plotly==5.24.1
plotly-resampler==0.10.0
Work around
This can be worked around by forcing import order:
import plotly.graph_objs # Force full initialization first
from plotly_resampler import FigureResampler # Then import resampler
- 主要言語
- Python
- スター
- 18.8k
- フォーク
- 2.8k
- 平均マージ
- 16時間 26分
- マージ済み PR(30日)
- 21
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
plotly/plotly.py のほかの issue
-
P3 size: 1 task
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
bug P1
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
-
feature P3
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
feature P3
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
plotly/plotly.py の issue をすべて見る
似ている issue
-
🐛 Bug 🔔 Pending processing
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
jumpserver/jumpserver#17584 ·
-
link-check link-check:sphinx-theme
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
OpenHands/extensions#626 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
CSCfi/sd-search-api#39 ·