Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boto3 UTC DeprecationWarnings #3889

Open
BookWorm0 opened this issue Oct 6, 2023 · 14 comments · May be fixed by boto/botocore#3239
Open

Boto3 UTC DeprecationWarnings #3889

BookWorm0 opened this issue Oct 6, 2023 · 14 comments · May be fixed by boto/botocore#3239
Labels
bug This issue is a confirmed bug. p2 This is a standard priority issue

Comments

@BookWorm0
Copy link

Describe the bug

Running the attached script under Python 3.12 with Python flag -Wa produces DepricationWarnings.
bug.txt

Expected Behavior

No warnings should be issued.

Current Behavior

For "import boto3", the warning is: dateutil\tz\tz.py:37: DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).
EPOCH = datetime.datetime.utcfromtimestamp(0)

For s3client.list_objects, the warning is: botocore\auth.py:419: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
datetime_now = datetime.datetime.utcnow()

Reproduction Steps

Rename the script from bug.txt to bug.py.

Run the script as follows from CMD.EXE:
py -Wa bug.py BUCKETNAME

where BUCKETNAME identifies an S3 bucket to which you are authorized to access.

Possible Solution

Boto source code should be modified as suggested in the warnings.

Additional Information/Context

No response

SDK version used

boto3-1.28.61 botocore-1.31.61

Environment details (OS name and version, etc.)

Windows 10 Pro Version 10.0.19045 Build 19045; Python 3.12.0

@BookWorm0 BookWorm0 added bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged. labels Oct 6, 2023
@tim-finnigan
Copy link
Contributor

Hi @BookWorm0 thanks for reaching out. The team is aware of this issue and working on addressing the warnings. These deprecations won't cause impact currently beyond the warnings. The required changes are not fully backwards compatible for existing usage. We'll be prioritizing a more robust fix in an upcoming release.

@kfrydel
Copy link

kfrydel commented Oct 16, 2023

@tim-finnigan Thank you very much!

@StevenMapes
Copy link

Any update on this as the warnings break my CI/CD flow unless I turn off error::DeprecationWarning which I really don't want to

@alex-morgun
Copy link

alex-morgun commented Jul 4, 2024

Add pytest decorator to affected tests, if you use pytest
@pytest.mark.filterwarnings("ignore:datetime.datetime.utcnow")

@nathanagez
Copy link

Hello @tim-finnigan, any updates on this?

@antoniogamizbadger
Copy link

Any updates on this?

samuelhwilliams added a commit to communitiesuk/funding-service-design-utils that referenced this issue Jul 31, 2024
We have two warnings on the repo at the moment, both from dependencies
(so outside of our control). One is from botocore
(boto/boto3#3889) and the other is from
sqlalchemy. Both are Python 3.12 DeprecationWarnings about
datetime.datetime.utcnow and datetime.datetime.utcfromtimestamp being
scheduled for removal in future python versions.
@aronyanez10
Copy link

Do you happen to have any updates on this?

kevinjqliu added a commit to kevinjqliu/iceberg-python that referenced this issue Aug 16, 2024
@Zedstron
Copy link

Any update regarding this, I am using Django and recently updated my python version from 3.9 to 3.12, and I simply can't ignore the warnings in multiple Django apps, as there are so many places using botocore.

@StevenMapes
Copy link

Any update regarding this, I am using Django and recently updated my python version from 3.9 to 3.12, and I simply can't ignore the warnings in multiple Django apps, as there are so many places using botocore.

It needs this PR on botocore to be merged in and released

@Zedstron
Copy link

So why they are not merging it? how can I use that PR in my project?

Any update regarding this, I am using Django and recently updated my python version from 3.9 to 3.12, and I simply can't ignore the warnings in multiple Django apps, as there are so many places using botocore.

It needs this PR on botocore to be merged in and released

@MedAzizTousli
Copy link

Any updates on this?

@tim-finnigan
Copy link
Contributor

Thanks all for your patience. The team is continuing to track this in the backlog — please feel free to 👍 the issue to +1 it. As mentioned in a related PR:

Unfortunately, this isn't as straight forward as replacing a function call. We already attempted this in 96ca907 when 3.12 support was released and needed to roll it back due to breaking date serialization changes.

We're currently looking at removing the warnings long term in a backwards compatible manner, but don't have a timeline to provide. The utcnow deprecation is currently slated sometime after Python 3.16, so it's at least few years out. We'll work on getting it addressed more timely.

@kurtmckee
Copy link

@tim-finnigan,

breaking date serialization changes

Does boto/botocore#3239 address this problem in a way that avoids the "breaking date serialization" problem?

If not, please leave feedback on that PR that points out the specific way that the date serialization breaks (and -- ideally -- a test case that I can use to ensure that PR addresses the problem).

Thanks!

@joaonsantos
Copy link

joaonsantos commented Dec 2, 2024

@tim-finnigan Any updates on this? This is burning through our log quota. Any alternatives other than filter warnings?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a confirmed bug. p2 This is a standard priority issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.