Circular Import Dependency in Plotly Templates
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 18.8k
- Forks
- 2.8k
- Ø Merge
- 16 Std. 26 Min.
- Gemergte PRs (30 T.)
- 21
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere den Fehler mit plotly==5.24.1 und plotly-resampler==0.10.0 und untersuche anschließend plotly.graph_objs.init.py sowie layout/template/data/_heatmapgl.py. Verfolge die Importreihenfolge aus dem gemeldeten FigureResampler-Beispiel. Als abgeschlossen gilt die Aufgabe, wenn das Beispiel die Abbildung importiert und erstellt, ohne dass zuvor manuell ein plotly.graph_objs-Import erforderlich ist.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- data-visualization
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 48/100