Skip to content

Commit

Permalink
refactor: Remove python-dateutil dependency (#2529)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
3 people authored Mar 3, 2021
1 parent f0056b8 commit e156177
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 6 deletions.
1 change: 0 additions & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion requirements/reproducible-linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
4 changes: 1 addition & 3 deletions samcli/lib/utils/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import datetime
import dateparser

from dateutil.tz import tzutc


def timestamp_to_iso(timestamp):
"""
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion tests/unit/lib/utils/test_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit e156177

Please sign in to comment.