Skip to content

Commit 92f9adb

Browse files
authored
chore: drop 3.8 support (#721)
1 parent 9d9e32e commit 92f9adb

File tree

72 files changed

+1479
-1482
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1479
-1482
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
strategy:
3535
fail-fast: true
3636
matrix:
37-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
37+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
3838
pydantic-version: ["1.10", "2.0"]
3939
sqla-version: ["1.4", "2"]
4040
exclude:

docs/examples/configuration/test_example_4.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from asyncio import sleep
22
from dataclasses import dataclass
3-
from typing import Dict, List
43
from uuid import UUID
54

65
from polyfactory import AsyncPersistenceProtocol, SyncPersistenceProtocol
@@ -14,7 +13,7 @@ class Person:
1413

1514

1615
# we will use a dictionary to persist values for the example
17-
mock_db: Dict[UUID, Person] = {}
16+
mock_db: dict[UUID, Person] = {}
1817

1918

2019
class SyncPersistenceHandler(SyncPersistenceProtocol[Person]):
@@ -24,7 +23,7 @@ def save(self, data: Person) -> Person:
2423
mock_db[data.id] = data
2524
return data
2625

27-
def save_many(self, data: List[Person]) -> List[Person]:
26+
def save_many(self, data: list[Person]) -> list[Person]:
2827
# same as for save, here we should store the list in persistence.
2928
# in this case, we use the same dictionary.
3029
for person in data:
@@ -40,7 +39,7 @@ async def save(self, data: Person) -> Person:
4039
await sleep(0.0001)
4140
return data
4241

43-
async def save_many(self, data: List[Person]) -> List[Person]:
42+
async def save_many(self, data: list[Person]) -> list[Person]:
4443
# same as for the async save, here we should store the list in persistence using async logic.
4544
# we again store in dict, and mock async using sleep.
4645
for person in data:

docs/examples/configuration/test_example_5.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from dataclasses import dataclass
22
from datetime import date, datetime
33
from enum import Enum
4-
from typing import Any, Dict, List, Union
4+
from typing import Any, Union
55
from uuid import UUID
66

77
from polyfactory import Use
@@ -24,11 +24,11 @@ class Pet:
2424
class Person:
2525
id: UUID
2626
name: str
27-
hobbies: List[str]
27+
hobbies: list[str]
2828
age: Union[float, int]
2929
birthday: Union[datetime, date]
30-
pets: List[Pet]
31-
assets: List[Dict[str, Dict[str, Any]]]
30+
pets: list[Pet]
31+
assets: list[dict[str, dict[str, Any]]]
3232

3333

3434
class PetFactory(DataclassFactory[Pet]):

docs/examples/configuration/test_example_6.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
from dataclasses import dataclass
2-
from typing import Tuple
32

43
from polyfactory.factories import DataclassFactory
54

65

76
@dataclass
87
class Owner:
9-
cars: Tuple[str, ...]
8+
cars: tuple[str, ...]
109

1110

1211
class OwnerFactory(DataclassFactory[Owner]):

docs/examples/declaring_factories/test_example_5.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from dataclasses import dataclass
22
from datetime import date, datetime
33
from enum import Enum
4-
from typing import Any, Dict, List, Union
4+
from typing import Any, Union
55
from uuid import UUID
66

77
from polyfactory.factories import DataclassFactory
@@ -23,11 +23,11 @@ class Pet:
2323
class Person:
2424
id: UUID
2525
name: str
26-
hobbies: List[str]
26+
hobbies: list[str]
2727
age: Union[float, int]
2828
birthday: Union[datetime, date]
29-
pets: List[Pet]
30-
assets: List[Dict[str, Dict[str, Any]]]
29+
pets: list[Pet]
30+
assets: list[dict[str, dict[str, Any]]]
3131

3232

3333
class PersonFactory(DataclassFactory[Person]): ...

docs/examples/declaring_factories/test_example_7.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from datetime import date, datetime
2-
from typing import Any, Dict, List, Union
2+
from typing import Any, Union
33
from uuid import UUID
44

55
import attrs
@@ -11,12 +11,12 @@
1111
class Person:
1212
id: UUID
1313
name: str
14-
hobbies: List[str]
14+
hobbies: list[str]
1515
age: Union[float, int]
1616
# an aliased variable
1717
birthday: Union[datetime, date] = attrs.field(alias="date_of_birth")
1818
# a "private" variable
19-
_assets: List[Dict[str, Dict[str, Any]]]
19+
_assets: list[dict[str, dict[str, Any]]]
2020

2121

2222
class PersonFactory(AttrsFactory[Person]): ...

docs/examples/fields/test_example_1.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from dataclasses import dataclass
22
from datetime import date, datetime
33
from enum import Enum
4-
from typing import Any, Dict, List, Union
4+
from typing import Any, Union
55
from uuid import UUID
66

77
from polyfactory.factories import DataclassFactory
@@ -23,11 +23,11 @@ class Pet:
2323
class Person:
2424
id: UUID
2525
name: str
26-
hobbies: List[str]
26+
hobbies: list[str]
2727
age: Union[float, int]
2828
birthday: Union[datetime, date]
29-
pets: List[Pet]
30-
assets: List[Dict[str, Dict[str, Any]]]
29+
pets: list[Pet]
30+
assets: list[dict[str, dict[str, Any]]]
3131

3232

3333
pet_instance = Pet(name="Roxy", sound="woof woof", species=Species.DOG)

docs/examples/fields/test_example_2.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from dataclasses import dataclass
22
from datetime import date, datetime
33
from enum import Enum
4-
from typing import Any, Dict, List, Union
4+
from typing import Any, Union
55
from uuid import UUID
66

77
from polyfactory import Use
@@ -24,11 +24,11 @@ class Pet:
2424
class Person:
2525
id: UUID
2626
name: str
27-
hobbies: List[str]
27+
hobbies: list[str]
2828
age: Union[float, int]
2929
birthday: Union[datetime, date]
30-
pets: List[Pet]
31-
assets: List[Dict[str, Dict[str, Any]]]
30+
pets: list[Pet]
31+
assets: list[dict[str, dict[str, Any]]]
3232

3333

3434
class PetFactory(DataclassFactory[Pet]):

docs/examples/fields/test_example_3.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from dataclasses import dataclass
22
from datetime import date, datetime
33
from enum import Enum
4-
from typing import Any, Dict, List, Union
4+
from typing import Any, Union
55
from uuid import UUID
66

77
from polyfactory import Use
@@ -24,11 +24,11 @@ class Pet:
2424
class Person:
2525
id: UUID
2626
name: str
27-
hobbies: List[str]
27+
hobbies: list[str]
2828
age: Union[float, int]
2929
birthday: Union[datetime, date]
30-
pets: List[Pet]
31-
assets: List[Dict[str, Dict[str, Any]]]
30+
pets: list[Pet]
31+
assets: list[dict[str, dict[str, Any]]]
3232

3333

3434
class PetFactory(DataclassFactory[Pet]):

docs/examples/fields/test_example_4.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from dataclasses import dataclass
22
from datetime import date, datetime
33
from enum import Enum
4-
from typing import Any, Dict, List, Union
4+
from typing import Any, Union
55
from uuid import UUID
66

77
from polyfactory import Use
@@ -24,11 +24,11 @@ class Pet:
2424
class Person:
2525
id: UUID
2626
name: str
27-
hobbies: List[str]
27+
hobbies: list[str]
2828
age: Union[float, int]
2929
birthday: Union[datetime, date]
30-
pets: List[Pet]
31-
assets: List[Dict[str, Dict[str, Any]]]
30+
pets: list[Pet]
31+
assets: list[dict[str, dict[str, Any]]]
3232

3333

3434
class PetFactory(DataclassFactory[Pet]):

0 commit comments

Comments
 (0)