diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 10a3ca516..86bc6bb81 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] + python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15.0-beta.2"] tox-test: ["default"] steps: diff --git a/khal/__init__.py b/khal/__init__.py index 36b60842b..e02c37c48 100644 --- a/khal/__init__.py +++ b/khal/__init__.py @@ -39,3 +39,23 @@ __description__ = "A standards based terminal calendar" __license__ = "Expat/MIT, see COPYING" __homepage__ = "https://lostpackets.de/khal/" + + +# Monkeypatch _strptime to support Python 3.15+ where parsing day of month (%d or %e) +# without a year directive raises a ValueError. +try: + import _strptime +except ImportError: + pass +else: + _orig_strptime = _strptime._strptime + + def _custom_strptime(data_string, format_string): + has_year = "%y" in format_string or "%Y" in format_string + has_day = "%d" in format_string or "%e" in format_string + if has_day and not has_year: + data_string = f"{data_string} 2024" + format_string = f"{format_string} %Y" + return _orig_strptime(data_string, format_string) + + _strptime._strptime = _custom_strptime diff --git a/pyproject.toml b/pyproject.toml index 67a1c3e14..de33cb412 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,10 +20,11 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: 3.15", "Topic :: Communications", "Topic :: Utilities", ] -requires-python = ">=3.10,<3.15" +requires-python = ">=3.10,<3.16" dependencies = [ "click>=3.2", "click_log>=0.2.0",