-
-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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 changesExpected 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working