From 0a666caa131386c282faf204755a73f0705cd46f Mon Sep 17 00:00:00 2001 From: Jacob Beck Date: Wed, 12 Jun 2019 11:13:44 -0600 Subject: [PATCH] Emit a big deprecation warning on python 2.x at the end of the run --- core/dbt/main.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/core/dbt/main.py b/core/dbt/main.py index 23a0cc59ef0..9a05f8e8227 100644 --- a/core/dbt/main.py +++ b/core/dbt/main.py @@ -106,6 +106,8 @@ def main(args=None): logger.error(traceback.format_exc()) exit_code = ExitCodes.UnhandledError + _python2_compatibility_message() + sys.exit(exit_code) @@ -175,6 +177,22 @@ def track_run(task): dbt.tracking.flush() +_PYTHON_27_WARNING = ''' +Python 2.7 will reach the end of its life on January 1st, 2020. +Please upgrade your Python as Python 2.7 won't be maintained after that date. +A future version of dbt will drop support for Python 2.7. +'''.strip() + + +def _python2_compatibility_message(): + if dbt.compat.WHICH_PYTHON != 2: + return + + logger.critical( + dbt.ui.printer.red('DEPRECATION: ') + _PYTHON_27_WARNING + ) + + def run_from_args(parsed): log_cache_events(getattr(parsed, 'log_cache_events', False)) flags.set_from_args(parsed)