Skip to content

Commit 10e660a

Browse files
authored
Merge pull request #460 from yukinarit/drop-python3.7
Drop python3.7
2 parents 514a38a + 47ab8d8 commit 10e660a

File tree

9 files changed

+21
-27
lines changed

9 files changed

+21
-27
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
strategy:
1111
matrix:
1212
# Remove pypy-3.8 until it supports numpy
13-
python-version: ["3.8", "3.9", "3.10", "3.11"] # "pypy-3.8"
13+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] # "pypy-3.8"
1414
steps:
1515
- uses: actions/checkout@v3
1616
- name: Install poetry

examples/literal.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
import sys
21
from dataclasses import dataclass
32

43
from serde.compat import SerdeError
5-
6-
if sys.version_info[:2] == (3, 7):
7-
from typing_extensions import Literal
8-
else:
9-
from typing import Literal
4+
from typing import Literal
105

116
from serde import serde
127
from serde.json import from_json, to_json

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ numpy = [
3737
{ version = ">1.21.0", markers = "python_version ~= '3.8.0' and (extra == 'numpy' or extra == 'all')", optional = true },
3838
{ version = ">1.21.0", markers = "python_version ~= '3.9.0' and (extra == 'numpy' or extra == 'all')", optional = true },
3939
{ version = ">1.22.0", markers = "python_version ~= '3.10' and (extra == 'numpy' or extra == 'all')", optional = true },
40+
{ version = ">1.22.0", markers = "python_version ~= '3.11' and (extra == 'numpy' or extra == 'all')", optional = true },
41+
{ version = ">1.22.0", markers = "python_version ~= '3.12' and (extra == 'numpy' or extra == 'all')", optional = true },
4042
]
4143
orjson = { version = "*", markers = "extra == 'orjson' or extra == 'all'", optional = true }
4244
plum-dispatch = "^2"

serde/compat.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@
3535
import typing_inspect
3636
from typing_extensions import Type, TypeGuard
3737

38-
if sys.version_info[:2] == (3, 7):
39-
Literal = typing_extensions.Literal
40-
else:
41-
Literal = typing.Literal
42-
4338
# Create alias for `dataclasses.Field` because `dataclasses.Field` is a generic
4439
# class since 3.9 but is not in 3.7 and 3.8.
4540
if sys.version_info[:2] <= (3, 8):
@@ -842,8 +837,6 @@ def is_literal(typ: Type[Any]) -> bool:
842837
False
843838
"""
844839
origin = get_origin(typ)
845-
if sys.version_info[:2] == (3, 7):
846-
return origin is typing_extensions.Literal
847840
return origin is not None and origin is typing.Literal
848841

849842

serde/de.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
overload,
2323
Union,
2424
Sequence,
25+
Literal,
2526
Iterable,
2627
)
2728

2829
import jinja2
2930
from typing_extensions import Type, dataclass_transform
3031

3132
from .compat import (
32-
Literal,
3333
SerdeError,
3434
SerdeSkip,
3535
T,

serde/se.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
TypeVar,
2525
Iterable,
2626
Union,
27+
Literal,
2728
)
2829

2930
import jinja2
3031
from typing_extensions import dataclass_transform
3132

3233
from .compat import (
33-
Literal,
3434
SerdeError,
3535
SerdeSkip,
3636
T,

tests/test_compat.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import sys
22
from dataclasses import dataclass
33
from datetime import datetime
4-
from typing import Any, Dict, Generic, List, NewType, Optional, Set, Tuple, TypeVar, Union
4+
from typing import Any, Dict, Generic, List, NewType, Optional, Set, Tuple, TypeVar, Union, Literal
55

66
import pytest
77

88
import serde
99
from serde.compat import (
10-
Literal,
1110
get_generic_arg,
1211
is_dict,
1312
is_generic,

tests/test_literal.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
import logging
2-
import sys
32
from dataclasses import dataclass
4-
from typing import Dict, List, Tuple
5-
6-
if sys.version_info[:2] == (3, 7):
7-
from typing_extensions import Literal
8-
else:
9-
from typing import Literal
3+
from typing import Dict, List, Tuple, Literal
104

115
import pytest
126

tests/test_union.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,19 @@
22
import sys
33
from dataclasses import dataclass
44
from ipaddress import IPv4Address
5-
from typing import Dict, FrozenSet, Generic, List, NewType, Optional, Tuple, TypeVar, Union, Any
5+
from typing import (
6+
Dict,
7+
FrozenSet,
8+
Generic,
9+
List,
10+
NewType,
11+
Optional,
12+
Tuple,
13+
TypeVar,
14+
Union,
15+
Any,
16+
Literal,
17+
)
618
from uuid import UUID
719

820
import pytest
@@ -20,7 +32,6 @@
2032
AdjacentTagging,
2133
Untagged,
2234
)
23-
from serde.compat import Literal
2435
from serde.json import from_json, to_json
2536

2637
logging.basicConfig(level=logging.WARNING)

0 commit comments

Comments
 (0)