From cfdb9831c502a456b047762ff9b701dba790e320 Mon Sep 17 00:00:00 2001 From: Christodoulos Tsoulloftas Date: Sun, 20 Oct 2024 19:08:42 +0300 Subject: [PATCH] Drop support for python 3.8 --- .github/workflows/tests.yml | 1 - docs/installation.md | 2 +- pyproject.toml | 3 +-- tests/formats/dataclass/cases/__init__.py | 1 - tests/formats/dataclass/cases/attribute.py | 22 ++++++----------- tests/formats/dataclass/cases/attributes.py | 10 +------- tests/formats/dataclass/cases/element.py | 27 ++++++--------------- tests/formats/dataclass/cases/elements.py | 15 +++--------- tests/models/test_config.py | 17 ------------- xsdata/formats/dataclass/typing.py | 2 +- xsdata/models/config.py | 7 ------ 11 files changed, 23 insertions(+), 84 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3774d6d5..f91bf540 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,7 +14,6 @@ jobs: fail-fast: false matrix: include: - - {name: Python 3.8, python: '3.8'} - {name: Python 3.9, python: '3.9'} - {name: Python 3.10, python: '3.10'} - {name: Python 3.11, python: '3.11'} diff --git a/docs/installation.md b/docs/installation.md index f22ae63f..287028c9 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -34,7 +34,7 @@ $ xsdata --help ## Requirements -!!! Note "xsData relies on these awesome libraries and supports `python >= 3.8`" +!!! Note "xsData relies on these awesome libraries and supports `python >= 3.9`" - [lxml](https://lxml.de/) - XML advanced features - [requests](https://requests.readthedocs.io/) - Webservice Default Transport diff --git a/pyproject.toml b/pyproject.toml index f687878e..126f2dfb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,6 @@ classifiers = [ "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -29,7 +28,7 @@ classifiers = [ "Topic :: Text Processing :: Markup :: XML", ] keywords = ["xsd", "wsdl", "schema", "dtd", "binding", "xml", "json", "dataclasses", "generator", "cli"] -requires-python = ">=3.8" +requires-python = ">=3.9" dependencies = [ "typing-extensions>=4.7.0", ] diff --git a/tests/formats/dataclass/cases/__init__.py b/tests/formats/dataclass/cases/__init__.py index dacb7683..fc8dcd60 100644 --- a/tests/formats/dataclass/cases/__init__.py +++ b/tests/formats/dataclass/cases/__init__.py @@ -1,4 +1,3 @@ import sys -PY39 = sys.version_info[:2] >= (3, 9) PY310 = sys.version_info[:2] >= (3, 10) diff --git a/tests/formats/dataclass/cases/attribute.py b/tests/formats/dataclass/cases/attribute.py index beae5aa2..9889b97f 100644 --- a/tests/formats/dataclass/cases/attribute.py +++ b/tests/formats/dataclass/cases/attribute.py @@ -1,7 +1,7 @@ from collections.abc import Iterable from typing import Dict, List, Literal, Optional, Set, Tuple, Union -from tests.formats.dataclass.cases import PY39, PY310 +from tests.formats.dataclass.cases import PY310 from xsdata.models.enums import Mode tokens = [ @@ -17,6 +17,13 @@ (List[int], ((int,), None, list)), (List[Union[str, int]], ((str, int), None, list)), (Optional[List[Union[str, int]]], ((str, int), None, list)), + (list[int, int], False), + (dict[str, str], False), + (dict, False), + (set[str], False), + (tuple[int, ...], ((int,), None, tuple)), + (list[int], ((int,), None, list)), + (list[Union[str, int]], ((str, int), None, list)), ] not_tokens = [ @@ -27,19 +34,6 @@ (Union[str, Mode], ((str, Mode), None, None)), ] -if PY39: - tokens.extend( - [ - (list[int, int], False), - (dict[str, str], False), - (dict, False), - (set[str], False), - (tuple[int, ...], ((int,), None, tuple)), - (list[int], ((int,), None, list)), - (list[Union[str, int]], ((str, int), None, list)), - ] - ) - if PY310: tokens.extend( [ diff --git a/tests/formats/dataclass/cases/attributes.py b/tests/formats/dataclass/cases/attributes.py index 5f0f8fac..18050821 100644 --- a/tests/formats/dataclass/cases/attributes.py +++ b/tests/formats/dataclass/cases/attributes.py @@ -1,8 +1,6 @@ from collections.abc import Mapping from typing import Dict, List, Set, Tuple -from tests.formats.dataclass.cases import PY39 - cases = [ (int, False), (Set, False), @@ -12,11 +10,5 @@ (Dict, ((str,), dict, None)), (Dict[str, str], ((str,), dict, None)), (Mapping[str, str], ((str,), dict, None)), + (dict[str, str], ((str,), dict, None)), ] - -if PY39: - cases.extend( - [ - (dict[str, str], ((str,), dict, None)), - ] - ) diff --git a/tests/formats/dataclass/cases/element.py b/tests/formats/dataclass/cases/element.py index a2640b26..77bfe0a4 100644 --- a/tests/formats/dataclass/cases/element.py +++ b/tests/formats/dataclass/cases/element.py @@ -1,8 +1,6 @@ from collections.abc import Iterable from typing import Dict, List, Optional, Set, Tuple, Union -from tests.formats.dataclass.cases import PY39 - tokens = [ (Set, False), (Dict[str, int], False), @@ -16,6 +14,11 @@ (Iterable[Iterable[str, ...]], ((str,), list, list)), (Tuple[List[str], ...], ((str,), tuple, list)), (Optional[Tuple[List[str], ...]], ((str,), tuple, list)), + (list[str], ((str,), None, list)), + (tuple[str, ...], ((str,), None, tuple)), + (list[list[str]], ((str,), list, list)), + (list[tuple[str, ...]], ((str,), list, tuple)), + (tuple[list[str], ...], ((str,), tuple, list)), ] not_tokens = [ @@ -30,22 +33,6 @@ (List[Union[str, int]], ((str, int), list, None)), (Optional[List[Union[str, int]]], ((str, int), list, None)), (Tuple[str, ...], ((str,), tuple, None)), + (list[str], ((str,), list, None)), + (tuple[str, ...], ((str,), tuple, None)), ] - -if PY39: - tokens.extend( - [ - (list[str], ((str,), None, list)), - (tuple[str, ...], ((str,), None, tuple)), - (list[list[str]], ((str,), list, list)), - (list[tuple[str, ...]], ((str,), list, tuple)), - (tuple[list[str], ...], ((str,), tuple, list)), - ] - ) - - not_tokens.extend( - [ - (list[str], ((str,), list, None)), - (tuple[str, ...], ((str,), tuple, None)), - ] - ) diff --git a/tests/formats/dataclass/cases/elements.py b/tests/formats/dataclass/cases/elements.py index 49863ad8..61a00881 100644 --- a/tests/formats/dataclass/cases/elements.py +++ b/tests/formats/dataclass/cases/elements.py @@ -1,6 +1,6 @@ from typing import Dict, List, Optional, Tuple, Union -from tests.formats.dataclass.cases import PY39, PY310 +from tests.formats.dataclass.cases import PY310 cases = [ (Dict, False), @@ -10,19 +10,12 @@ (Optional[Union[str, int]], ((object,), None, None)), (Union[str, int, None], ((object,), None, None)), (List[Union[List[str], Tuple[str, ...]]], ((object,), list, None)), + (list[str], ((object,), list, None)), + (tuple[str, ...], ((object,), tuple, None)), + (list[Union[list[str], tuple[str, ...]]], ((object,), list, None)), ] -if PY39: - cases.extend( - [ - (list[str], ((object,), list, None)), - (tuple[str, ...], ((object,), tuple, None)), - (list[Union[list[str], tuple[str, ...]]], ((object,), list, None)), - ] - ) - - if PY310: cases.extend( [ diff --git a/tests/models/test_config.py b/tests/models/test_config.py index c4c89596..3bfd2c37 100644 --- a/tests/models/test_config.py +++ b/tests/models/test_config.py @@ -136,23 +136,6 @@ def test_format_with_invalid_eq_config(self): self.assertEqual("Enabling eq because order is true", str(w[-1].message)) - def test_subscriptable_types_requires_390(self): - if sys.version_info < (3, 9): - with warnings.catch_warnings(record=True) as w: - self.assertFalse( - GeneratorOutput(subscriptable_types=True).subscriptable_types - ) - - self.assertEqual( - "Generics PEP 585 requires python >= 3.9, reverting...", - str(w[-1].message), - ) - - else: - self.assertTrue( - GeneratorOutput(subscriptable_types=True).subscriptable_types - ) - def test_use_union_type_requires_310_and_postponed_annotations(self): if sys.version_info < (3, 10): with warnings.catch_warnings(record=True) as w: diff --git a/xsdata/formats/dataclass/typing.py b/xsdata/formats/dataclass/typing.py index cb1202fd..b190c0bc 100644 --- a/xsdata/formats/dataclass/typing.py +++ b/xsdata/formats/dataclass/typing.py @@ -1,5 +1,5 @@ import sys -from collections.abc import Iterable, Iterator, Mapping +from collections.abc import Iterable, Mapping from typing import ( Any, Callable, diff --git a/xsdata/models/config.py b/xsdata/models/config.py index 1f8d1b5b..7b11b9a0 100644 --- a/xsdata/models/config.py +++ b/xsdata/models/config.py @@ -257,13 +257,6 @@ def __post_init__(self): def validate(self): """Reset configuration conflicts.""" - if self.subscriptable_types and sys.version_info < (3, 9): - self.subscriptable_types = False - warnings.warn( - "Generics PEP 585 requires python >= 3.9, reverting...", - CodegenWarning, - ) - if self.union_type and sys.version_info < (3, 10): self.union_type = False warnings.warn(