Skip to content

Replace utcnow() with timezone-aware object#1484

Closed
leewujung wants to merge 14 commits intoOSOceanAcoustics:mainfrom
leewujung:fix_utcnow
Closed

Replace utcnow() with timezone-aware object#1484
leewujung wants to merge 14 commits intoOSOceanAcoustics:mainfrom
leewujung:fix_utcnow

Conversation

@leewujung
Copy link
Copy Markdown
Member

This PR addresses the warning
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).
that occurs in various places in our codebase.

@leewujung leewujung added this to the v0.10.1 milestone Apr 3, 2025
@leewujung leewujung requested a review from ctuguinay April 3, 2025 20:12
@leewujung
Copy link
Copy Markdown
Member Author

Ugh @ctuguinay sorry this is not ready for review yet. I'll ping again once it is.

@leewujung leewujung removed the request for review from ctuguinay April 3, 2025 20:18
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 5, 2025

Codecov Report

Attention: Patch coverage is 72.72727% with 3 lines in your changes missing coverage. Please review.

Project coverage is 71.31%. Comparing base (9f56124) to head (a95065b).
Report is 203 commits behind head on main.

Files with missing lines Patch % Lines
echopype/consolidate/api.py 75.00% 1 Missing ⚠️
echopype/echodata/echodata.py 66.66% 1 Missing ⚠️
echopype/mask/api.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1484       +/-   ##
===========================================
- Coverage   83.52%   71.31%   -12.21%     
===========================================
  Files          64       22       -42     
  Lines        5686     1492     -4194     
===========================================
- Hits         4749     1064     -3685     
+ Misses        937      428      -509     
Flag Coverage Δ
unittests 71.31% <72.72%> (-12.21%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@leewujung
Copy link
Copy Markdown
Member Author

Turns out that datetime.UTC was only added in python=3.11 so the 3.10 test is failing!

Onward with a version handler.

@leewujung
Copy link
Copy Markdown
Member Author

@shivam096 : I haven’t had a chance to get back to this, but perhaps this would be a standalone issue that you can jump on easily? I haven’t looked at the latest failing report, but if the tests that are failing are actually not related to utcnow, let me know and we can see whether to address it in another PR or this one.

@leewujung
Copy link
Copy Markdown
Member Author

This is superseded by #1497. Closing now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants