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

Fix DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. #1261

Merged
merged 3 commits into from
Jan 24, 2025

Conversation

shcherbin
Copy link
Contributor

@shcherbin shcherbin commented Jan 23, 2025

This pull request includes updates to address a deprecation warning and increment the version number. The most important changes include updating the datetime.utcfromtimestamp method to datetime.fromtimestamp with timezone information and updating the version number.

Fixes for deprecation warning:

  • pynamodb/attributes.py: Replaced datetime.utcfromtimestamp with datetime.fromtimestamp in the _normalize and deserialize methods to handle timezone information correctly. [1] [2]

Version update:

Documentation:

  • docs/release_notes.rst: Added release notes for version 6.0.2, including the fix for the datetime.utcfromtimestamp deprecation warning.

…cated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC)
@shcherbin
Copy link
Contributor Author

@garrettheel, could you please find a moment to review this PR?
I'm using this library in one of my projects, and this Deprecation warning is driving me crazy :)

@ikonst
Copy link
Contributor

ikonst commented Jan 23, 2025

Mind bumping the minor version and amending docs/release_notes.rst? Otherwise no new version will be released.

@shcherbin
Copy link
Contributor Author

Thank you for looking into this, @ikonst. I made the changes you asked for. Please take another look.

@shcherbin
Copy link
Contributor Author

shcherbin commented Jan 24, 2025

I see the build fails.
Can it be related to actions/setup-python#962 ?
Based on the discussion there, it looks like 3.7 is no longer available on ubuntu runners. I can patch the actions pipeline in this PR.
Let me know what you think, @ikonst

@ikonst
Copy link
Contributor

ikonst commented Jan 24, 2025

Thanks for fixing CI!

@ikonst ikonst merged commit a5c1f4e into pynamodb:master Jan 24, 2025
13 checks passed
@shcherbin shcherbin deleted the cyril/fix-DeprecationWarning branch January 24, 2025 15:28
@shcherbin
Copy link
Contributor Author

Thank you, @ikonst, for merging my PR :) When are you planning to roll out the next release?

@ikonst
Copy link
Contributor

ikonst commented Jan 24, 2025

@shcherbin Done, thanks for the reminder. (I forgot to make the release. Just merging isn't enough.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants