From e15617758c133bfdee1c973ae0c445ff1a5b0703 Mon Sep 17 00:00:00 2001 From: Michiel van Baak Date: Wed, 3 Mar 2021 19:22:16 +0100 Subject: [PATCH] refactor: Remove python-dateutil dependency (#2529) * Remove upper limit of 2.8.0 for python-dateutil. * Drop python-dateutil dependency * Re-add dateutil to ATTRIBUTION since it is in the build-image (dependency of dependency) * Run make update-reproducible-reqs now we are no longer directly depending on python-dateutil Co-authored-by: Mathieu Grandis <73313235+mgrandis@users.noreply.github.com> Co-authored-by: _sam <3804518+aahung@users.noreply.github.com> --- requirements/base.txt | 1 - requirements/reproducible-linux.txt | 1 - samcli/lib/utils/time.py | 4 +--- tests/unit/lib/utils/test_time.py | 1 - 4 files changed, 1 insertion(+), 6 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index 7cc04dcc34..ff36daceca 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -10,7 +10,6 @@ aws-sam-translator==1.34.0 #docker minor version updates can include breaking changes. Auto update micro version only. docker~=4.2.0 dateparser~=0.7 -python-dateutil~=2.6, <2.8.1 requests==2.23.0 serverlessrepo==0.1.10 aws_lambda_builders==1.3.0 diff --git a/requirements/reproducible-linux.txt b/requirements/reproducible-linux.txt index 20786dc9fc..f3e6fd4ec3 100644 --- a/requirements/reproducible-linux.txt +++ b/requirements/reproducible-linux.txt @@ -167,7 +167,6 @@ python-dateutil==2.8.0 \ --hash=sha256:c89805f6f4d64db21ed966fda138f8a5ed7a4fdbc1a8ee329ce1b74e3c74da9e # via # arrow - # aws-sam-cli (setup.py) # botocore # dateparser python-slugify==4.0.1 \ diff --git a/samcli/lib/utils/time.py b/samcli/lib/utils/time.py index 02b078337f..3190f8f519 100644 --- a/samcli/lib/utils/time.py +++ b/samcli/lib/utils/time.py @@ -5,8 +5,6 @@ import datetime import dateparser -from dateutil.tz import tzutc - def timestamp_to_iso(timestamp): """ @@ -92,7 +90,7 @@ def to_utc(some_time): # Convert timezone aware objects to UTC if some_time.tzinfo and some_time.utcoffset(): - some_time = some_time.astimezone(tzutc()) + some_time = some_time.astimezone(datetime.timezone.utc) # Now that time is UTC, simply remove the timezone component. return some_time.replace(tzinfo=None) diff --git a/tests/unit/lib/utils/test_time.py b/tests/unit/lib/utils/test_time.py index df63d2cc81..d049518eb3 100644 --- a/tests/unit/lib/utils/test_time.py +++ b/tests/unit/lib/utils/test_time.py @@ -4,7 +4,6 @@ from unittest import TestCase from samcli.lib.utils.time import to_timestamp, timestamp_to_iso, parse_date, to_utc, utc_to_timestamp -from dateutil.tz import tzutc class TestTimestampToIso(TestCase):