Skip to content
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

Allow non ASCII in JSON dump with env var #3257

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
1 change: 1 addition & 0 deletions src/zenml/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def handle_int_env_var(var: str, default: int = 0) -> int:
ENV_ZENML_PIPELINE_RUN_API_TOKEN_EXPIRATION = (
"ZENML_PIPELINE_API_TOKEN_EXPIRATION"
)
ENV_ZENML_ALLOW_NON_ASCII_MATERIALIZERS_DUMPS = "ZENML_ALLOW_NON_ASCII_MATERIALIZERS_DUMPS"

# ZenML Server environment variables
ENV_ZENML_SERVER_PREFIX = "ZENML_SERVER_"
Expand Down
8 changes: 8 additions & 0 deletions src/zenml/utils/yaml_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,16 @@

import yaml

from zenml.constants import (
ENV_ZENML_ALLOW_NON_ASCII_MATERIALIZERS_DUMPS,
handle_bool_env_var,
)
from zenml.io import fileio
from zenml.utils import io_utils

ZENML_ALLOW_NON_ASCII_MATERIALIZERS_DUMPS = handle_bool_env_var(
Frank995 marked this conversation as resolved.
Show resolved Hide resolved
ENV_ZENML_ALLOW_NON_ASCII_MATERIALIZERS_DUMPS, False
)

def write_yaml(
file_path: str,
Expand Down Expand Up @@ -142,6 +149,7 @@ def write_json(
file_path,
json.dumps(
contents,
ensure_ascii=not ZENML_ALLOW_NON_ASCII_MATERIALIZERS_DUMPS,
Frank995 marked this conversation as resolved.
Show resolved Hide resolved
cls=encoder,
),
)
Expand Down
Loading