Skip to content

Commit

Permalink
Emit a big deprecation warning on python 2.x at the end of the run
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Beck committed Jun 13, 2019
1 parent e57c7b6 commit aa28968
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions core/dbt/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ def main(args=None):
logger.error(traceback.format_exc())
exit_code = ExitCodes.UnhandledError

_python2_compatibility_message()

sys.exit(exit_code)


Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit aa28968

Please sign in to comment.