From Fedora Project Wiki
(Initial change proposal, WIP)
 
 
(One intermediate revision by the same user not shown)
Line 7: Line 7:
 
Note that motivation for the change should be in the Benefit to Fedora section below, and this part should answer the question "What?" rather than "Why?". -->
 
Note that motivation for the change should be in the Benefit to Fedora section below, and this part should answer the question "What?" rather than "Why?". -->
  
The {{package|pytz}} ({{package|python3-pytz}}) package will be [https://docs.fedoraproject.org/en-US/packaging-guidelines/deprecating-packages/ deprecated] in [[Releases/35|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 upstream to switch to the standard library for newer Python versions.
+
The {{package|pytz}} ({{package|python3-pytz}}) package will be [https://docs.fedoraproject.org/en-US/packaging-guidelines/deprecating-packages/ deprecated] in [[Releases/35|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 ==
 
== Owner ==
Line 52: Line 52:
 
<!-- Expand on the summary, if appropriate.  A couple sentences suffices to explain the goal, but the more details you can provide the better. -->
 
<!-- Expand on the summary, if appropriate.  A couple sentences suffices to explain the goal, but the more details you can provide the better. -->
  
...
+
The {{package|pytz}} package is a [https://pypi.org/project/pytz/ 3rd party Python package] to work with TZ (time zone) data.
 +
 
 +
Since Python 3.9 and [https://www.python.org/dev/peps/pep-0615/ PEP 615], the package is no longer necessary. The [https://docs.python.org/3.9/library/zoneinfo.html 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 {{package|tzdata}}. Moreover, the usage of pytz can [https://blog.ganssle.io/articles/2018/03/pytz-fastest-footgun.html 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 {{package|python3-pytz}}, hence we want to have it [https://docs.fedoraproject.org/en-US/packaging-guidelines/deprecating-packages/ deprecated].
 +
 
 +
Note that the change owners maintain {{package|pytz}} in Fedora and RHEL. The package was [https://github.com/minimization/content-resolver-input/pull/480 already marked as unwanted for RHEL 10+].
  
 
=== How to migrate to the standard library ===
 
=== How to migrate to the standard library ===
  
...
+
... How indeed? ...
  
 
==== Support for older Pythons ====
 
==== Support for older Pythons ====
Line 72: Line 78:
 
  except ImportError:
 
  except ImportError:
 
     from backports import zoneinfo
 
     from backports import zoneinfo
 +
 +
=== Packages that (Build)Require pytz ===
 +
 +
{{admon/important | No action needed | The change owners will not do any mass changes. Packagers are encouraged to work with upstreams to migrate away from pytz, but the change owners don't plan to force the transition downstream in Fedora. We plan to work with anaconda and babel to accelerate the removal from Fedora ELN.}}
 +
 +
$ (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 ==
 
== Feedback ==

Latest revision as of 12:48, 12 February 2021


Deprecate pytz

Summary

The Package-x-generic-16.pngpytz (Package-x-generic-16.pngpython3-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

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 Package-x-generic-16.pngpytz 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 Package-x-generic-16.pngtzdata. 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 Package-x-generic-16.pngpython3-pytz, hence we want to have it deprecated.

Note that the change owners maintain Package-x-generic-16.pngpytz 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

Important.png
No action needed
The change owners will not do any mass changes. Packagers are encouraged to work with upstreams to migrate away from pytz, but the change owners don't plan to force the transition downstream in Fedora. We plan to work with anaconda and babel to accelerate the removal from Fedora ELN.
$ (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 Package-x-generic-16.pngpython3-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 Package-x-generic-16.pngpython3-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 Package-x-generic-16.pngpython3-libs, because it cannot work as drop-in replacement. The package will eventually be obsoleted by Package-x-generic-16.pngfedora-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)

Release Notes