pimutils / pimutils/khal

Unconditional importlib_metadata dependency required for Python 3.8

Open
#1,408 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3.1k
Forks
233
Avg merge
1h 44m
Merged PRs (30d)
1

Description

Describe the bug
After upgrading khal from 0.11.3 to 0.11.4, it throws ModuleNotFoundError: No module named 'importlib_metadata' on every invocation.

Turns out the dependency is only declared for the test extra, but it's actually required on normal use already (though plugins.py_compat.py).

/opt/pipx/venvs/khal/lib/python3.8/site-packages/khal-0.11.4.dist-info/METADATA
Requires-Dist: importlib-metadata; python_version <= "3.9" and extra == "test"

If applicable: Stack Trace

$ khal
Traceback (most recent call last):
  File "/usr/local/bin/khal", line 5, in <module>
    from khal.cli import main_khal
  File "/opt/pipx/venvs/khal/lib/python3.8/site-packages/khal/cli.py", line 33, in <module>
    from . import controllers, plugins
  File "/opt/pipx/venvs/khal/lib/python3.8/site-packages/khal/controllers.py", line 35, in <module>
    from khal import __productname__, __version__, calendar_display, parse_datetime
  File "/opt/pipx/venvs/khal/lib/python3.8/site-packages/khal/calendar_display.py", line 29, in <module>
    from .khalendar import CalendarCollection
  File "/opt/pipx/venvs/khal/lib/python3.8/site-packages/khal/khalendar/__init__.py", line 22, in <module>
    from .khalendar import CalendarCollection  # noqa: F401  # type: ignore
  File "/opt/pipx/venvs/khal/lib/python3.8/site-packages/khal/khalendar/khalendar.py", line 38, in <module>
    from .event import Event
  File "/opt/pipx/venvs/khal/lib/python3.8/site-packages/khal/khalendar/event.py", line 41, in <module>
    from ..plugins import FORMATTERS
  File "/opt/pipx/venvs/khal/lib/python3.8/site-packages/khal/plugins.py", line 3, in <module>
    from khal._compat import importlib_metadata
  File "/opt/pipx/venvs/khal/lib/python3.8/site-packages/khal/_compat.py", line 8, in <module>
    import importlib_metadata
ModuleNotFoundError: No module named 'importlib_metadata'

To Reproduce
Invoke khal.

Expected behavior
No errors.

OS, version, khal version and how you installed it:

  • The output of khal --version: khal, version 0.11.4
  • Installation method: pipx
  • python version: Python 3.8.10
  • OS: Ubuntu 20.04.6 LTS

Workaround
Install the dependency manually: pipx inject --global khal importlib-metadata

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with khal/plugins.py and khal/_compat.py to confirm the runtime import path and reproduce the Python 3.8 failure by invoking khal without the extra dependency. Then inspect the project’s dependency declaration and ensure importlib_metadata is installed for normal use; done means khal starts successfully on Python 3.8 without manual injection.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.