Skip to content

Commit

Permalink
Drop support for python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
tefra committed Oct 20, 2024
1 parent 3a8d574 commit cfdb983
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 84 deletions.
1 change: 0 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'}
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
]
Expand Down
1 change: 0 additions & 1 deletion tests/formats/dataclass/cases/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys

PY39 = sys.version_info[:2] >= (3, 9)
PY310 = sys.version_info[:2] >= (3, 10)
22 changes: 8 additions & 14 deletions tests/formats/dataclass/cases/attribute.py
Original file line number Diff line number Diff line change
@@ -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 = [
Expand All @@ -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 = [
Expand All @@ -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(
[
Expand Down
10 changes: 1 addition & 9 deletions tests/formats/dataclass/cases/attributes.py
Original file line number Diff line number Diff line change
@@ -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),
Expand All @@ -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)),
]
)
27 changes: 7 additions & 20 deletions tests/formats/dataclass/cases/element.py
Original file line number Diff line number Diff line change
@@ -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),
Expand All @@ -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 = [
Expand All @@ -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)),
]
)
15 changes: 4 additions & 11 deletions tests/formats/dataclass/cases/elements.py
Original file line number Diff line number Diff line change
@@ -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),
Expand All @@ -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(
[
Expand Down
17 changes: 0 additions & 17 deletions tests/models/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion xsdata/formats/dataclass/typing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import sys
from collections.abc import Iterable, Iterator, Mapping
from collections.abc import Iterable, Mapping
from typing import (
Any,
Callable,
Expand Down
7 changes: 0 additions & 7 deletions xsdata/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit cfdb983

Please sign in to comment.