From 3b2b02c5d58d52bc184f46276508d7021721e566 Mon Sep 17 00:00:00 2001 From: Erik Cederstrand Date: Mon, 28 Oct 2024 13:01:06 +0100 Subject: [PATCH] Drop support for Python 3.8 --- .github/workflows/python-package.yml | 8 ++++---- CHANGELOG.md | 1 + exchangelib/__init__.py | 2 +- exchangelib/ewsdatetime.py | 7 +------ pyproject.toml | 3 +-- scripts/optimize.py | 6 +----- tests/common.py | 6 +----- tests/test_ewsdatetime.py | 6 +----- tests/test_field.py | 6 +----- tests/test_items/test_contacts.py | 6 +----- tests/test_items/test_generic.py | 6 +----- tests/test_protocol.py | 6 +----- tests/test_restriction.py | 6 +----- 13 files changed, 16 insertions(+), 53 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 00d2c297..3016a424 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -29,10 +29,10 @@ jobs: needs: pre_job strategy: matrix: - python-version: ['3.8', '3.12'] + python-version: ['3.9', '3.13'] include: # Allow failure on Python dev - e.g. Cython install regularly fails - - python-version: "3.13-dev" + - python-version: "3.14-dev" allowed_failure: true max-parallel: 1 @@ -58,7 +58,7 @@ jobs: - name: Install cutting-edge Cython-based packages on Python dev versions continue-on-error: ${{ matrix.allowed_failure || false }} - if: matrix.python-version == '3.13-dev' + if: matrix.python-version == '3.14-dev' run: | sudo apt-get install libxml2-dev libxslt1-dev python -m pip install git+https://github.com/cython/cython.git @@ -96,7 +96,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: '3.11' + python-version: '3.13' - name: Unencrypt secret file env: diff --git a/CHANGELOG.md b/CHANGELOG.md index e1c2ec9a..c44bf75e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Change Log HEAD ---- +- Dropped support for Python 3.8 which is EOL per October 7, 2024. 5.4.3 diff --git a/exchangelib/__init__.py b/exchangelib/__init__.py index 7f5776c6..940a7619 100644 --- a/exchangelib/__init__.py +++ b/exchangelib/__init__.py @@ -106,9 +106,9 @@ "discover", ] -# Set a default user agent, e.g. "exchangelib/3.1.1 (python-requests/2.22.0)" import requests.utils +# Set a default user agent, e.g. "exchangelib/5.4.3 (python-requests/2.31.0)" BaseProtocol.USERAGENT = f"{__name__}/{__version__} ({requests.utils.default_user_agent()})" diff --git a/exchangelib/ewsdatetime.py b/exchangelib/ewsdatetime.py index d2f15b9b..ac3ad204 100644 --- a/exchangelib/ewsdatetime.py +++ b/exchangelib/ewsdatetime.py @@ -1,10 +1,6 @@ import datetime import logging - -try: - import zoneinfo -except ImportError: - from backports import zoneinfo +import zoneinfo import tzlocal @@ -283,7 +279,6 @@ def from_timezone(cls, tz): try: return { cls.__module__.split(".")[0]: lambda z: z, - "backports": cls.from_zoneinfo, "datetime": cls.from_datetime, "dateutil": cls.from_dateutil, "pytz": cls.from_pytz, diff --git a/pyproject.toml b/pyproject.toml index fa160517..551f438a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ name = "exchangelib" dynamic = ["version"] description = "Client for Microsoft Exchange Web Services (EWS)" readme = {file = "README.md", content-type = "text/markdown"} -requires-python = ">=3.8" +requires-python = ">=3.9" license = {text = "BSD-2-Clause"} keywords = [ "autodiscover", @@ -38,7 +38,6 @@ classifiers = [ "Programming Language :: Python :: 3", ] dependencies = [ - 'backports.zoneinfo; python_version < "3.9"', "cached_property", "defusedxml >= 0.6.0", "dnspython >= 2.2.0", diff --git a/scripts/optimize.py b/scripts/optimize.py index 45934509..4325b167 100755 --- a/scripts/optimize.py +++ b/scripts/optimize.py @@ -5,13 +5,9 @@ import datetime import logging import time +import zoneinfo from pathlib import Path -try: - import zoneinfo -except ImportError: - from backports import zoneinfo - from yaml import safe_load from exchangelib import DELEGATE, Account, CalendarItem, Configuration, Credentials, FaultTolerance diff --git a/tests/common.py b/tests/common.py index d1c0be05..9092d3df 100644 --- a/tests/common.py +++ b/tests/common.py @@ -5,17 +5,13 @@ import time import unittest import unittest.util +import zoneinfo from collections import namedtuple from decimal import Decimal from pathlib import Path from yaml import safe_load -try: - import zoneinfo -except ImportError: - from backports import zoneinfo - from exchangelib.account import Account, Identity from exchangelib.attachments import FileAttachment from exchangelib.configuration import Configuration diff --git a/tests/test_ewsdatetime.py b/tests/test_ewsdatetime.py index 86e0ccb4..1c1b4ded 100644 --- a/tests/test_ewsdatetime.py +++ b/tests/test_ewsdatetime.py @@ -1,15 +1,11 @@ import datetime import unittest +import zoneinfo import dateutil.tz import pytz import requests_mock -try: - import zoneinfo -except ImportError: - from backports import zoneinfo - from exchangelib.errors import NaiveDateTimeNotAllowed, UnknownTimeZone from exchangelib.ewsdatetime import UTC, EWSDate, EWSDateTime, EWSTimeZone from exchangelib.util import CONNECTION_ERRORS diff --git a/tests/test_field.py b/tests/test_field.py index ad7128b1..db877d6c 100644 --- a/tests/test_field.py +++ b/tests/test_field.py @@ -1,13 +1,9 @@ import datetime import warnings +import zoneinfo from collections import namedtuple from decimal import Decimal -try: - import zoneinfo -except ImportError: - from backports import zoneinfo - from exchangelib.extended_properties import ExternId from exchangelib.fields import ( Base64Field, diff --git a/tests/test_items/test_contacts.py b/tests/test_items/test_contacts.py index 9498cee8..2ae9aa8e 100644 --- a/tests/test_items/test_contacts.py +++ b/tests/test_items/test_contacts.py @@ -1,9 +1,5 @@ import datetime - -try: - import zoneinfo -except ImportError: - from backports import zoneinfo +import zoneinfo from exchangelib.errors import ErrorInvalidIdMalformed from exchangelib.folders import Contacts diff --git a/tests/test_items/test_generic.py b/tests/test_items/test_generic.py index b9e73a83..7880e270 100644 --- a/tests/test_items/test_generic.py +++ b/tests/test_items/test_generic.py @@ -1,9 +1,5 @@ import datetime - -try: - import zoneinfo -except ImportError: - from backports import zoneinfo +import zoneinfo from exchangelib.attachments import ItemAttachment from exchangelib.errors import ErrorInternalServerError, ErrorItemNotFound diff --git a/tests/test_protocol.py b/tests/test_protocol.py index 52d0a42c..c5567aad 100644 --- a/tests/test_protocol.py +++ b/tests/test_protocol.py @@ -4,14 +4,10 @@ import socket import tempfile import warnings +import zoneinfo from contextlib import suppress from unittest.mock import Mock, patch -try: - import zoneinfo -except ImportError: - from backports import zoneinfo - import psutil import requests_mock from oauthlib.oauth2 import InvalidClientIdError diff --git a/tests/test_restriction.py b/tests/test_restriction.py index 0e31cae0..8abe16cb 100644 --- a/tests/test_restriction.py +++ b/tests/test_restriction.py @@ -1,9 +1,5 @@ import datetime - -try: - import zoneinfo -except ImportError: - from backports import zoneinfo +import zoneinfo from exchangelib.folders import Calendar, Root from exchangelib.queryset import Q