From 3dfa66272f15c0f3eb5b4b4ddfcf49fa1af1e3b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herman=20Zvonimir=20Do=C5=A1ilovi=C4=87?= Date: Sun, 9 Nov 2025 14:07:28 +0100 Subject: [PATCH 1/2] Add support for env variable JUDGE0_SUPPRESS_PREVIEW_WARNING. --- src/judge0/__init__.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/judge0/__init__.py b/src/judge0/__init__.py index b2a4dcb4..5fca86d0 100644 --- a/src/judge0/__init__.py +++ b/src/judge0/__init__.py @@ -106,11 +106,12 @@ def _get_implicit_client(flavor: Flavor) -> Client: def _get_preview_client(flavor: Flavor) -> Union[Judge0CloudCE, Judge0CloudExtraCE]: - logger.warning( - "You are using a preview version of the client which is not recommended" - " for production.\n" - "For production, please specify your API key in the environment variable." - ) + if not suppress_preview_warning: + logger.warning( + "You are using a preview version of the client which is not recommended" + " for production.\n" + "For production, please specify your API key in the environment variable." + ) if flavor == Flavor.CE: return Judge0CloudCE() @@ -234,3 +235,5 @@ def _get_hub_client(flavor: Flavor) -> Union[Client, None]: SWIFT = LanguageAlias.SWIFT TYPESCRIPT = LanguageAlias.TYPESCRIPT VISUAL_BASIC = LanguageAlias.VISUAL_BASIC + +suppress_preview_warning = os.getenv("JUDGE0_SUPPRESS_PREVIEW_WARNING") is not None From f770db57d3ef34cbb82f321582d87ec11b347225 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Karlo=20Do=C5=A1ilovi=C4=87?= Date: Sun, 9 Nov 2025 21:02:43 +0100 Subject: [PATCH 2/2] Minor change to preview warning suppression logic --- src/judge0/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/judge0/__init__.py b/src/judge0/__init__.py index 5fca86d0..b74df46e 100644 --- a/src/judge0/__init__.py +++ b/src/judge0/__init__.py @@ -65,6 +65,7 @@ JUDGE0_IMPLICIT_CE_CLIENT = None JUDGE0_IMPLICIT_EXTRA_CE_CLIENT = None +SUPPRESS_PREVIEW_WARNING = os.getenv("JUDGE0_SUPPRESS_PREVIEW_WARNING") logger = logging.getLogger(__name__) @@ -106,7 +107,7 @@ def _get_implicit_client(flavor: Flavor) -> Client: def _get_preview_client(flavor: Flavor) -> Union[Judge0CloudCE, Judge0CloudExtraCE]: - if not suppress_preview_warning: + if SUPPRESS_PREVIEW_WARNING is not None: logger.warning( "You are using a preview version of the client which is not recommended" " for production.\n" @@ -235,5 +236,3 @@ def _get_hub_client(flavor: Flavor) -> Union[Client, None]: SWIFT = LanguageAlias.SWIFT TYPESCRIPT = LanguageAlias.TYPESCRIPT VISUAL_BASIC = LanguageAlias.VISUAL_BASIC - -suppress_preview_warning = os.getenv("JUDGE0_SUPPRESS_PREVIEW_WARNING") is not None