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 for datetime.utcfromtimestamp in Python 3.12 #1519

Merged
merged 1 commit into from Feb 6, 2024

Conversation

jamate16
Copy link
Contributor

@jamate16 jamate16 commented Oct 4, 2023

Summary

This PR fixes the DeprecationWarning that is raised when using datetime.datetime.utcfromtimestamp in Python 3.12.

Changes made

In the tqdm/std.py file:

  • Changed the import statement from from datetime import datetime, timedelta to from datetime import datetime, timedelta, timezone.
  • Replaced datetime.datetime.utcfromtimestamp(0) with datetime.datetime.fromtimestamp(0, datetime.timezone.utc).

Linked Issue

This PR fixes issue [#1517]: "Use of datetime.datetime.utcfromtimestamp shows DeprecationWarning in Python 3.12".

How to test

The changes have been tested on Python 3.12 and the warning is no longer raised.

Fixes [#1517]

@EwoutH
Copy link

EwoutH commented Oct 23, 2023

Thanks for resolving this DeprecationWarning, I also encountered it. What's needed to get this merged?

@jamate16 jamate16 force-pushed the fix-deprecation-warning-python3.12 branch from c8de501 to 6945b21 Compare October 23, 2023 19:37
@ChristopherJPfaff
Copy link

ChristopherJPfaff commented Nov 30, 2023

bump
tested locally, resolves the warning issue.

@RemDelaporteMathurin
Copy link

Any progress on this? 👀

@casperdcl casperdcl changed the base branch from master to devel February 6, 2024 11:37
Copy link
Sponsor Member

@casperdcl casperdcl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Sorry for the delay :)

@casperdcl casperdcl added to-merge ↰ Imminent p2-bug-warning ⚠ Visual output bad c1-quick 🕐 Complexity low labels Feb 6, 2024
@casperdcl casperdcl merged commit 48b2a0e into tqdm:devel Feb 6, 2024
1 check passed
@casperdcl casperdcl added this to Done in Casper Feb 6, 2024
@casperdcl casperdcl mentioned this pull request Feb 6, 2024
scottstanie added a commit to scottstanie/dolphin that referenced this pull request Feb 7, 2024
scottstanie added a commit to isce-framework/dolphin that referenced this pull request Feb 7, 2024
* use `datetime.now(timezone.utc)` to avoid py312 deprecation warnings

* fix typo and fix mac arm problem in `FileIO`

* add macos-14, fail fast

* try gdal 3.5

* try not specifying isce3, back to gdal 3.5

* remove rich, replace with tqdm

* update changelog

* add back req

* fix `desc`

* pass through `tqdm_args` to avoid clobbering bars

closes #123

* temp workaround for python 3.12 problems

tqdm/tqdm#1519

tqdm/tqdm#1250

* try disable in gha
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c1-quick 🕐 Complexity low p2-bug-warning ⚠ Visual output bad to-merge ↰ Imminent
Projects
Casper
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

6 participants