8000 Fix `orjson` loading error by emilykl · Pull Request #4562 · plotly/plotly.py · GitHub
[go: up one dir, main page]

Skip to content

Fix orjson loading error #4562

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

Merged
merged 7 commits into from
Apr 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
import orjson on initial load
  • Loading branch information
emilykl committed Mar 29, 2024
commit 186bd755fbf00e374503e0be2da79a53f788b968
4 changes: 4 additions & 0 deletions packages/python/plotly/plotly/io/_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
from _plotly_utils.optional_imports import get_module
from _plotly_utils.basevalidators import ImageUriValidator

# Ensure `orjson` module is loaded immediately if present (to avoid error on hot reload)
get_module("orjson", should_load=True)


# Orca configuration class
# ------------------------
Expand Down Expand Up @@ -105,6 +108,7 @@ def to_json_plotly(plotly_object, pretty=False, engine=None):
--------
to_json : Convert a plotly Figure to JSON with validation
"""

orjson = get_module("orjson", should_load=True)

# Determine json engine
Expand Down
0