From 090f2e0442d517212c47e4296dff35dc89ade816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Luis=20Cano=20Rodr=C3=ADguez?= Date: Tue, 4 Jul 2023 11:00:06 +0100 Subject: [PATCH] Add toggleable error if Python version is incompatible MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Juan Luis Cano Rodríguez --- kedro/__init__.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/kedro/__init__.py b/kedro/__init__.py index be9febd329..9c6ac0a7b6 100644 --- a/kedro/__init__.py +++ b/kedro/__init__.py @@ -3,4 +3,24 @@ configuration and pipeline assembly. """ +import sys +import warnings + __version__ = "0.18.11" + + +class KedroPythonVersionWarning(UserWarning): + pass + + +if not sys.warnoptions: + warnings.simplefilter("error", KedroPythonVersionWarning) + +if sys.version_info >= (3, 11): + warnings.warn( + """Kedro is not yet fully compatible with this Python version. +To proceed at your own risk and ignore this warning, +run Kedro with `python -W "default:Kedro is not yet fully compatible" -m kedro ...` +or set the PYTHONWARNINGS environment variable accordingly.""", + KedroPythonVersionWarning, + )