Deprecate pytz
Summary
The pytz
(python3-pytz
) package will be deprecated in Fedora 35. Packages in Fedora should use Python standard library modules, such as dateutil.tz
and zoneinfo
(available since Python 3.9) instead. Some packages still depend on pytz
, so we cannot remove it yet. Packagers are encouraged to work with upstreams to switch to the standard library for newer Python versions.
Owner
- Name: Miro Hrončok, Gwyn Ciesla
- Email: mhroncok@redhat.com
Current status
- Targeted release: Fedora 35
- Last updated: 2021-02-12
- FESCo issue: <will be assigned by the Wrangler>
- Tracker bug: <will be assigned by the Wrangler>
- Release notes tracker: <will be assigned by the Wrangler>
Detailed Description
The pytz
package is a 3rd party Python package to work with TZ (time zone) data.
Since Python 3.9 and PEP 615, the package is no longer necessary. The zoneinfo module was added to Python standard library to provide a concrete time zone implementation supporting the IANA time zone database. By default, zoneinfo uses use the system's time zone data from tzdata
. Moreover, the usage of pytz can lead to unexpected results if not used very carefully.
Fedora has recent enough versions of Python, hence using pytz is no longer necessary. Eventually, we'd like to drop it from Fedora entirely, if possible. Before we attempt to remove the package, we need to stop new packages to (Build)Require python3-pytz
, hence we want to have it deprecated.
Note that the change owners maintain pytz
in Fedora and RHEL. The package was already marked as unwanted for RHEL 10+.
How to migrate to the standard library
... How indeed? ...
Support for older Pythons
When support for older Python versions is desired in upstream, it can be added via the backports.zoneinfo package.
In the metadata, the package is required like this:
backports.zoneinfo;python_version<"3.9"
In code, it is used via an try-import
mechanism, such as:
try: import zoneinfo except ImportError: from backports import zoneinfo
Packages that (Build)Require pytz
$ (repoquery --repo=koji{,-source} --whatrequires python3-pytz | grep src$; repoquery --repo=koji --whatrequires python3-pytz --source) | pkgname | sort | uniq anaconda babel certbot cinnamon copr-backend copr-frontend cozy fedora-messaging gnome-feeds jrnl khal limnoria oraculum prewikka python-acme python-APScheduler python-arrow python-astral python-astroplan python-bravado-core python-celery python-ciso8601 python-convertdate python-cryptography python-dateparser python-dateutils python-django python-django-helpdesk python-django-timezone-field python-fastavro python-fedmsg-meta-fedora-infrastructure python-feedgenerator python-flask-babel python-flask-restful python-flask-restplus python-flask-restx python-fs python-geopy python-google-api-core python-graphene python-hass-data-detective python-hdate python-icalendar python-inema python-influxdb python-kajiki python-kombu python-marshmallow python-Mastodon python-matplotlib python-metno python-moksha-common python-neotime python-oslo-serialization python-oslo-utils python-OWSLib python-pandas python-pelican python-pygrocy python-pyrfc3339 python-pysaml2 python-pyvirtualize python-ring-doorbell python-serpent python-snaptime python-sqlalchemy-utils python-subliminal python-tasklib python-tempora python-twilio python-tzlocal python-wikitcms python-xmp-toolkit python-zeep rpy vertica-python vit
Feedback
Positive feedback from Anaconda developers: https://listman.redhat.com/archives/anaconda-devel-list/2021-February/msg00020.html
Benefit to Fedora
More packages will use the standard library over a potentially dangerous third party package.
Eventually, we might be able to drop pytz from Fedora.
Scope
- Proposal owners: Deprecate
python3-pytz
and update the package description. Provide help migrating to the standard library to other packagers who ask for it.
- Other developers: No action needed. Don't add new dependencies on
python3-pytz
. If interested, migrate existing packages to the standard library (feel free to ask for help). Upstream work is recommended.
- Release engineering: no impact on Release Engineering is anticipated
- Policies and guidelines: N/A (not a System Wide Change)
- Trademark approval: N/A (not needed for this Change)
- Alignment with Objectives: Minimization: By dropping the extra dependency (e.g. from anaconda), we can have smaller systems.
Upgrade/compatibility impact
The package will remain available. Only new packages cannot depend on it.
Once retired (in distant future), we don't plan to obsolete/provide python3-pytz
from python3-libs
, because it cannot work as drop-in replacement. The package will eventually be obsoleted by fedora-obsolete-packages
once Python is updated to 3.N+1 after the removal to avoid broken upgrades.
How To Test
$ repoquery --repo=rawhide --provides python3-pytz ... deprecated() ...
User Experience
No changes.
Dependencies
N/A (not a System Wide Change)
Contingency Plan
- Contingency mechanism: (What to do? Who will do it?) N/A (not a System Wide Change)
- Contingency deadline: N/A (not a System Wide Change)
- Blocks release? N/A (not a System Wide Change), Yes/No
- Blocks product? product
Documentation
N/A (not a System Wide Change)