python-babel / flask-babel

i18n and l10n support for Flask based on Babel and pytz
https://python-babel.github.io/flask-babel/
Other
431 stars 159 forks source link

RFE: use `zoneinfo` instead of `pytz` #240

Open kloczek opened 1 month ago

kloczek commented 1 month ago

Switch to standard zoneinfo module. Below may help https://github.com/pydantic/pydantic-core/commit/fd262933

[tkloczko@pers-jacek flask-babel-4.0.0]$ grep -r pytz
README.md:[babel][] and [pytz][] modules.
README.md:[pytz]: https://pypi.python.org/pypi/pytz/
docs/index.rst:any Flask application with the help of `babel`_, `pytz`_ and its own copy of
docs/index.rst:.. _pytz: https://pythonhosted.org/pytz/
flask_babel/__init__.py:from pytz import timezone, UTC
flask_babel/__init__.py:        `pytz.timezone` object.
flask_babel/__init__.py:    a `pytz.timezone` object.  This returns `None` if used outside a request.
pyproject.toml:pytz = ">=2022.7"
TkTech commented 1 week ago

zoneinfo is only available in Python 3.9+ and we currently support versions before that. When 3.8 hits EOL in 2024-10, we'll switch.

kloczek commented 1 week ago

All what you wrote is 100% accurate. In dropped in RFE commit you have example how to handle that.

andreymal commented 1 week ago

There is backports.zoneinfo (and Django 4.2 uses it, for example)