python-restx / flask-restx

Fork of Flask-RESTPlus: Fully featured framework for fast, easy and documented API development with Flask
https://flask-restx.readthedocs.io/en/latest/
Other
2.16k stars 335 forks source link

Fixed failed unit tests caused by using `pytz` inappropriately #621

Open buttonfly1000 opened 1 month ago

buttonfly1000 commented 1 month ago

As per the document https://pythonhosted.org/pytz/ :

Unfortunately using the tzinfo argument of the standard datetime constructors 'does not work' with pytz for many timezones.

This fixes https://github.com/python-restx/flask-restx/issues/620

foarsitter commented 1 month ago

Thanks @buttonfly1000

Here is some background on the issue: https://engineering.backmarket.com/moving-forward-in-pythons-time-and-time-zones-aa3ccbd4569a

I think we need to remove pytz and implement zoneinfo. Thos is a 3.9 feature but support for 3.8 is EOL on 31 Oct 2024 so it can be dropped safely.

foarsitter commented 1 month ago

In https://github.com/python-restx/flask-restx/pull/622 I replaced pytz with stdlib equivalents.

peter-doggart commented 1 week ago

@foarsitter I agree, moving to stdlib is the way to go here.