twilio / twilio-python

A Python module for communicating with the Twilio API and generating TwiML.
MIT License
1.84k stars 703 forks source link

Drop unnecessary dependency on `pytz` - stdlib provides `datetime.timezone.utc` #720

Closed Zac-HD closed 11 months ago

Zac-HD commented 1 year ago

This package currently depends on pytz, which is incompatible with Python's standard timezone handling and thus being removed throughout the ecosystem in favor of the zoneinfo module. When I saw that twilio was using it, my heart sank but I resolved to open an issue.

But there's good news: you're not actually using any pytz interfaces! Literally the only thing you're using is the pytz.utc timezone object, which can be perfectly replaced with the standard library datetime.timezone.utc object in all four places it's used (including tests). Doing so should make your and, all your users', dependency-management ever so slightly easier.

I'll send a PR shortly, if nobody beats me to the punch 🙂

AsabuHere commented 11 months ago

Hi @Zac-HD, This PR is reviewed and approved by our team. Please merge once the checks are successful