Re: F39 Change Proposal: Allow Removal of tzdata (System-Wide)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Dne 26. 06. 23 v 22:12 Fabio Valentini napsal(a):
On Mon, Jun 26, 2023 at 8:40 PM Vít Ondruch <vondruch@xxxxxxxxxx> wrote:

Dne 26. 06. 23 v 20:24 Fabio Valentini napsal(a):
On Mon, Jun 26, 2023 at 8:10 PM Miro Hrončok <mhroncok@xxxxxxxxxx> wrote:
(snip)

---

The current problem with Python without tzdata is:

=======================================================================
   >>> from zoneinfo import ZoneInfo
   >>> ZoneInfo("Europe/Prague")
Traceback (most recent call last):
     File "/usr/lib64/python3.11/zoneinfo/_common.py", line 12, in load_tzdata
       return resources.files(package_name).joinpath(resource_name).open("rb")
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/lib64/python3.11/importlib/resources/_common.py", line 22, in files
       return from_package(get_package(package))
                           ^^^^^^^^^^^^^^^^^^^^
     File "/usr/lib64/python3.11/importlib/resources/_common.py", line 53, in
get_package
       resolved = resolve(package)
                  ^^^^^^^^^^^^^^^^
     File "/usr/lib64/python3.11/importlib/resources/_common.py", line 44, in resolve
       return cand if isinstance(cand, types.ModuleType) else
importlib.import_module(cand)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/lib64/python3.11/importlib/__init__.py", line 126, in import_module
       return _bootstrap._gcd_import(name[level:], package, level)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
     File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
     File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
     File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
     File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
     File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
     File "<frozen importlib._bootstrap>", line 1126, in _find_and_load_unlocked
     File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
     File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
     File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
     File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'tzdata'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "/usr/lib64/python3.11/zoneinfo/_common.py", line 24, in load_tzdata
       raise ZoneInfoNotFoundError(f"No time zone found with key {key}")
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key Europe/Prague'
=======================================================================

Not that ZoneInfo("UTC") also fails:

=======================================================================
   >>> ZoneInfo("UTC")
Traceback (most recent call last):
...
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key UTC'
=======================================================================

So we would need to patch Python to detect missing tzdata and report something
like:

    ZoneInfoNotInstalledError: 'No time zone information installed on the system,
you can only use UTC'

We would also need to ensure UTC work even without tzdata installed.

I would be reluctant to carry this as a downstream-only patch. And the upstream
window for changes like this has already closed for Python 3.12.
Does this mean that tzdata needs to be present for doing datetime /
timezone calculations at runtime with the zoneinfo module?
Would this Change require that all Python programs that use this
module add "Requires: tzdata"? I don't think that would be a
reasonable change.

There's a similar issue with some Rust libraries (and probably other
language-specific timezone handling libraries),

Yep, this is the case for rubygem-tzinfo. It would deserve recommends at
minimum, because in theory, the tzdata can be suplied by tzinfo-data gem
instead.
That might work with something like

Requires: (tzdata or rubygem(tzinfo-data))


We don't have rubygem-tzinfo-data in Fedora. But it can be installed via `gem install` or Bundler. So that is the reason for soft dependency.


Vít


Suggests: tzdata

(similarly for python, since there's a tzdata package on pypi as well)

But this comes at the cost of still pulling in tzdata, potentially in
different flavors and formats, in different stages of being outdated,
further bloating install size ... which is what this change is trying
to avoid?

So all this considered, I'm not sure whether this change is actually
worth it, if tzdata databases of some form will likely be pulled into
installs anyway.
I'd rather have *one* tzdata that's up-to-date and used by everything
(for example, so Python and Ruby programs can actually agree what time
it is).

Fabio
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux