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

Transition from pytz to zoneinfo #609

Closed
3 tasks done
Tracked by #630
niccokunzmann opened this issue Mar 27, 2024 · 3 comments
Closed
3 tasks done
Tracked by #630

Transition from pytz to zoneinfo #609

niccokunzmann opened this issue Mar 27, 2024 · 3 comments
Labels
nlnet Development is funded by NLNet & NGI Zero Core https://nlnet.nl/project/OpenWebCalendar

Comments

@niccokunzmann
Copy link
Member

niccokunzmann commented Mar 27, 2024

In EOL of Python 3.8 is 31st October 2024. Then, zoneinfo is the library that is shipped with Python. There are problems using pytz as timezone implementations have evolved. My proposal to solve this issue is the following:

  • create icalendar.set_default_timezone_implementation(TimeZone) where TimeZone can be pytz.Timezone or zoneinfo.ZoneInfo or others, taking a string like "UTC" or Europe/Berlin.
  • Allow a switch from zoneinfo to pytz by testing all timezone dependent tests with both implementations
  • a version 6 release after October will then switch from pytz to zoneinfo by setting another default and removing pytz altogether as a dependency. Tracked here: Version 6 - roadmap #630

What are your thoughts? Who thinks this will break existing code? What is needed for a transition?

See also:

Possibly related:

Code that needs touching:
The Timezone class contains logic to parse and create timezones from icalendar specifications:

class Timezone(Component):

@niccokunzmann
Copy link
Member Author

niccokunzmann commented Jun 4, 2024

Also:

  • Pytz has certain timezone names. We should support all of them with zoneinfo., see Zoneinfo #623 (comment)
  • Empty the timezone cache when switching timezone implementations.
  • Maybe, we can do a pre-release and ask people to test it and come back with ideas. - tracked in Version 6 - roadmap #630
  • make tzdata a dependency
  • document how to switch the timezone provider
  • run the tests with pytz as default and with zoneinfo as default (set at the start before any test is run) - we have global state. This is how we test that it really works with both versions.

For a new release:

@niccokunzmann niccokunzmann mentioned this issue Jun 4, 2024
3 tasks
@niccokunzmann
Copy link
Member Author

I created #623 to work on some improvements.

This was referenced Jun 18, 2024
@niccokunzmann
Copy link
Member Author

This is complete. We do not depend on pytz any more.

🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nlnet Development is funded by NLNet & NGI Zero Core https://nlnet.nl/project/OpenWebCalendar
Projects
None yet
Development

No branches or pull requests

1 participant