From 718c1032575ab3fed0bd469fbf53306daeda7b1d Mon Sep 17 00:00:00 2001 From: Roger Yang Date: Thu, 21 Nov 2024 16:11:15 -0800 Subject: [PATCH] fix: add backup import for ujson_dumps --- src/phoenix/utilities/json.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/phoenix/utilities/json.py b/src/phoenix/utilities/json.py index c9715da1d1..0b5c0bf8e3 100644 --- a/src/phoenix/utilities/json.py +++ b/src/phoenix/utilities/json.py @@ -8,11 +8,17 @@ import numpy as np import pandas as pd -from pandas.io.json import build_table_schema, ujson_dumps # type: ignore +from pandas.io.json import build_table_schema from pandas.io.json._table_schema import parse_table_schema # type: ignore from strawberry import UNSET from strawberry.types.base import StrawberryObjectDefinition +try: + from pandas.io.json import ujson_dumps # type: ignore +except ImportError: + # https://github.com/pandas-dev/pandas/pull/54581 + from pandas.io.json import dumps as ujson_dumps # type: ignore + def jsonify(obj: Any) -> Any: """