Skip to content

chore: replace pytz with zoneinfo#35749

Closed
mumarkhan999 wants to merge 4 commits intomasterfrom
umar/remove-pytz
Closed

chore: replace pytz with zoneinfo#35749
mumarkhan999 wants to merge 4 commits intomasterfrom
umar/remove-pytz

Conversation

@mumarkhan999
Copy link
Contributor

@mumarkhan999 mumarkhan999 commented Oct 31, 2024

Description

The alternative of some methods and variables of pytz is not available in zoneinfo.

from pytz import common_timezones, common_timezones_set, country_timezones

So currently we haven't been able to obliterate pytz. We are using them simultaneously.

@mumarkhan999 mumarkhan999 requested review from a team as code owners October 31, 2024 12:18
@mumarkhan999 mumarkhan999 removed request for a team October 31, 2024 13:57
@mumarkhan999 mumarkhan999 force-pushed the umar/remove-pytz branch 7 times, most recently from c9ecb0e to 1042fd7 Compare November 5, 2024 16:06
@mumarkhan999 mumarkhan999 force-pushed the umar/remove-pytz branch 10 times, most recently from 6f94e9a to b86974e Compare January 8, 2025 10:05
user_timezone_locale = user_timezone_locale_prefs(crum.get_current_request())
user_timezone = timezone(user_timezone_locale['user_timezone'] or browser_timezone or str(UTC))
return user_timezone.localize(datetime.now())
user_timezone = ZoneInfo(user_timezone_locale['user_timezone'] or browser_timezone or "UTC")
Copy link
Member

Choose a reason for hiding this comment

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

Is the ZoneInfo result already localized?

Copy link
Member

Choose a reason for hiding this comment

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

reference for this change?

except UnknownTimeZoneError as err:
return timezone('UTC')
return ZoneInfo(user_timezone)
except KeyError:
Copy link
Member

Choose a reason for hiding this comment

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

Why not use UnknownZoneInfoError here as used in some files above?

@mumarkhan999 mumarkhan999 force-pushed the umar/remove-pytz branch 2 times, most recently from d3d735b to 18baec4 Compare April 10, 2025 08:55
@mumarkhan999 mumarkhan999 force-pushed the umar/remove-pytz branch 8 times, most recently from e94b717 to 2049a92 Compare April 14, 2025 08:48
@mumarkhan999 mumarkhan999 force-pushed the umar/remove-pytz branch 7 times, most recently from 5967e80 to 9824eb3 Compare June 4, 2025 08:03
@feanil
Copy link
Contributor

feanil commented Jan 9, 2026

Closing this old out of date PR. Feel free to re-open after an update and tag me if it's still relevant.

@feanil feanil closed this Jan 9, 2026
@feanil feanil deleted the umar/remove-pytz branch January 9, 2026 15:00
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.

4 participants

Comments