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

Deprecation warning datetime.datetime.utcnow(). #2213

Closed
aguzmans opened this issue Mar 27, 2024 · 5 comments · Fixed by #2215
Closed

Deprecation warning datetime.datetime.utcnow(). #2213

aguzmans opened this issue Mar 27, 2024 · 5 comments · Fixed by #2215
Assignees
Labels
kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.

Comments

@aguzmans
Copy link

We are using using this library for some e2e testing and receive a few deprecation warnings about this line

https://github.com/kubernetes-client/python/blame/851dc2a0b10d1bc07826c6ade489d1bd2ef431c3/kubernetes/base/config/kube_config.py#L83

The warning looks like this:

(...)
/my/paht/kubernetes/config/kube_config.py:83: 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).

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html

python version: python3.12
using venv and installed the library with pip via requirements.txt file.

(...)
kubernetes==29
(...)
@aguzmans aguzmans changed the title Deprecation warning. Deprecation warning datetime.datetime.utcnow(). Mar 27, 2024
@roycaihw
Copy link
Member

/help

Is there a new method that can be used to replace this method? If so, would you like to send a PR?

@k8s-ci-robot
Copy link
Contributor

@roycaihw:
This request has been marked as needing help from a contributor.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-help command.

In response to this:

/help

Is there a new method that can be used to replace this method? If so, would you like to send a PR?

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Mar 27, 2024
@showjason
Copy link
Contributor

/assign

@aguzmans
Copy link
Author

aguzmans commented Apr 1, 2024

/help

Is there a new method that can be used to replace this method? If so, would you like to send a PR?

I think my knowledge of the project is too limited, I am more of an incidental user. the fix should not be hard, but it might take me very long to get anything meaningful moving.

@roycaihw
Copy link
Member

roycaihw commented Apr 1, 2024

/help
Is there a new method that can be used to replace this method? If so, would you like to send a PR?

I think my knowledge of the project is too limited, I am more of an incidental user. the fix should not be hard, but it might take me very long to get anything meaningful moving.

No problem! Thank you @aguzmans for reporting the issue. And @showjason thank you for opening the PR!

@roycaihw roycaihw added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. and removed help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants