Long term, it is probably best to move off of pytz. If you're okay to require Python >= 3.9 (released October 2020), then just use the built-in zoneinfo package.
There are a few differences in how the two libraries treat repeated dates at daylight saving transitions: pytz tried to solve the problem back when there was ambiguity in the datetime module. The zoneinfo module was designed after they fixed the ambiguity and works a little differently. Chances are things will just work though.
The zoneinfo package does not rely on a hard coded list of time zones, so does not require updates when tzdata changes.
Long term, it is probably best to move off of pytz. If you're okay to require Python >= 3.9 (released October 2020), then just use the built-in zoneinfo package.
import pytz => import zoneinfo timezone( "foo") => zoneinfo. ZoneInfo( "foo") all_timezones => zoneinfo. available_ timezones( )
pytz.
pytz.
There are a few differences in how the two libraries treat repeated dates at daylight saving transitions: pytz tried to solve the problem back when there was ambiguity in the datetime module. The zoneinfo module was designed after they fixed the ambiguity and works a little differently. Chances are things will just work though.
The zoneinfo package does not rely on a hard coded list of time zones, so does not require updates when tzdata changes.