diff --git a/papermill/engines.py b/papermill/engines.py index 4d096ba5..4eef38a3 100644 --- a/papermill/engines.py +++ b/papermill/engines.py @@ -122,7 +122,7 @@ def __init__(self, nb, output_path=None, log_output=False, progress_bar=True, au def now(self): """Helper to return current UTC time""" - return datetime.datetime.utcnow() + return datetime.datetime.now(datetime.timezone.utc) def set_timer(self): """ diff --git a/papermill/parameterize.py b/papermill/parameterize.py index b2422487..72c1194d 100644 --- a/papermill/parameterize.py +++ b/papermill/parameterize.py @@ -1,4 +1,4 @@ -from datetime import datetime +from datetime import datetime, timezone from uuid import uuid4 import nbformat @@ -23,7 +23,7 @@ def add_builtin_parameters(parameters): "pm": { "run_uuid": str(uuid4()), "current_datetime_local": datetime.now(), - "current_datetime_utc": datetime.utcnow(), + "current_datetime_utc": datetime.now(timezone.utc), } }