Describe the bug ποΈ
After calling register_plotly_resampler(mode="auto"), using isinstance(fig, go.Figure) raises a TypeError instead of returning a boolean. This breaks downstream code that validates figure instances with isinstance().
Reproducing the bug π
import numpy as np
import plotly.graph_objects as go
from plotly.graph_objs._figure import Figure
from plotly_resampler import register_plotly_resampler
if __name__ == "__main__":
# Before registration, this works fine
fig = go.Figure()
print(isinstance(fig, go.Figure)) # True
# After registration, this raises TypeError
register_plotly_resampler(mode="auto")
fig = go.Figure()
print(isinstance(fig, go.Figure)) # TypeError!
print(isinstance(fig, Figure)) # This would work but requires downstream code changes
Expected behavior π§
isinstance(fig, go.Figure) should return True even after register_plotly_resampler() has been called, since FigureResampler should be a subclass of go.Figure.
Environment information:
- OS: Windows
- Python environment:
- Python version: Python 3.13.11
- plotly-resampler environment: Issue persists both in Python scripts and Jupyter
- plotly-resampler version: 0.11.0
Additional context
Workaround requires importing the private Figure class directly. This forces consumers to either use the private API or modify their validation logic.
Describe the bug ποΈ
After calling
register_plotly_resampler(mode="auto"), usingisinstance(fig, go.Figure)raises aTypeErrorinstead of returning a boolean. This breaks downstream code that validates figure instances withisinstance().Reproducing the bug π
Expected behavior π§
isinstance(fig, go.Figure)should returnTrueeven afterregister_plotly_resampler()has been called, sinceFigureResamplershould be a subclass ofgo.Figure.Environment information:
Additional context
Workaround requires importing the private
Figureclass directly. This forces consumers to either use the private API or modify their validation logic.