-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace global validate state with Figure level validate flag #2403
Conversation
@jonmmease do we lose the context manager approach in this case? how does |
Yes, we do lose the context manager. It should propagate through There's more I would want to do testing wise before advertising in. In particular, we should do all of the figure factory and px tests with validation disabled and make sure they all work properly. |
Roger that. There's something else I don't understand, about the bug that I hit... The symptom I saw was that PX was producing figures with invalid |
BTW I plan to merge #2402 to ensure that PX isn't relying on magical |
This exact thing will only happen with the title* family of properties. The special logic to convert Basically, no coercions will take place. So things like pandas Series won't be converted to numpy arrays, they'll stay in the figure as Series. PIL images won't be converted to base64 encoded png strings. Colorscales won't be auto converted from names or lists into plotly.js form. |
OK so turning validation off means we need to be a lot more careful, and for instance PX figures will not work all that well unless we produce only figures that don't need any kind of coercion, which is 100% not the case right now. In light of this, do we even want to introduce |
We use it internally to handle loading/creating |
Got it. Then I would favour |
@jonmmease could you append a little changelog item for this whole performance thing BTW please ? :) |
Done and done @nicolaskruchten, thanks for the review. Go ahead and merge when you're ready! |
Thanks very much! |
This PR removes the global
graph_objects.validate
class. This class was introduce in #2368 as a way to globally disable figure property validation. While testing master, it seems that this global validation state can result in race conditions. Fortunately, this class was never included in a plotly.py release so we can still change the design.This PR replaces that approach with Figure-level
_validate
property. Validation for a Figure (or other graph object) can be disabled by passing avalidate=False
kwarg.cc @nicolaskruchten