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

The utcnow() method will be deprecated soon. Replaced it with recommened method. #161

Closed
wants to merge 1 commit into from

Conversation

asifrahaman13
Copy link

Hey I noticed that at some places the utcnow() method has been use.

Since the function will be deprecated soon I have replaced this with the recommended one.

from datetime import datetime, UTC
print(datetime.now(UTC))

@asifrahaman13 asifrahaman13 requested a review from frgfm as a code owner May 13, 2024 05:47
@frgfm
Copy link
Member

frgfm commented May 13, 2024

Hey @asifrahaman13!
Thanks for the PR 🙂 there are a few details but at high level, the old syntax gets deprecated in Python 3.12. Datetime being part of the standard library, it follows python version, and currently the lib supports Python from 3.9 on. As you can see, mypy indicates that UTC cannot be imported from datetime in python 3.9 😅

So either:

  • there is another way to do this that is valid for 3.9 and 3.12
  • or we'll have to find another way

Btw, it seems you have run the formater / linter, have you installed precommit hooks? 🙂

Cheers

@asifrahaman13
Copy link
Author

Hey @frgfm

Thanks for the clarification. Sorry I guess I did not configured it correctly. Will do it soon!

@asifrahaman13 asifrahaman13 closed this by deleting the head repository Jun 6, 2024
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