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

Avoid datetime deprecations in releaseWizard.py #751

Conversation

gerlowskija
Copy link
Contributor

Python 3.12 deprecates two popular datetime functions that are used throughout the Release Wizard, 'utcnow()' and 'utcfromtimestamp()', resulting in many distracting messages that make the other wizard output hard to read, e.g.

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).

This commit updates our 'datetime' usage in accordance with the Python recommendations.

Python 3.12 deprecates two popular datetime functions that are used
throughout the Release Wizard, 'utcnow()' and 'utcfromtimestamp()',
resulting in many distracting messages that make the other wizard output
hard to read, e.g.

```
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).
```

This commit updates our 'datetime' usage in accordance with the Python
recommendations.
Copy link
Contributor

@HoustonPutman HoustonPutman left a comment

Choose a reason for hiding this comment

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

gotta love python.

@gerlowskija
Copy link
Contributor Author

The releaseWizard requires at least Python 3.4 and the replacement functions ('now' and 'fromtimestamp') have been around at least that long, so this should be safe to merge in that respect at least.

@HoustonPutman
Copy link
Contributor

Nah, it's a good change. Thanks for doing the housekeeping!

@gerlowskija gerlowskija merged commit f55725f into apache:main Jan 24, 2025
1 check passed
@gerlowskija gerlowskija deleted the update-wizard-to-avoid-datetime-deprecation-warnings branch January 24, 2025 19:03
gerlowskija added a commit that referenced this pull request Jan 24, 2025
Python 3.12 deprecates two popular datetime functions that are used
throughout the Release Wizard, 'utcnow()' and 'utcfromtimestamp()',
resulting in many distracting messages that make the other wizard output
hard to read, e.g.

```
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).
```

This commit updates our 'datetime' usage in accordance with the Python
recommendations.
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.

3 participants