Skip to content

Commit b2fcd06

Browse files
committed
deprecate python 3.9
Manual changes (that weren't addressed by `uvx pyupgrade`)
1 parent 36a88fb commit b2fcd06

File tree

17 files changed

+105
-802
lines changed

17 files changed

+105
-802
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
strategy:
3333
fail-fast: true
3434
matrix:
35-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
35+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]
3636
pydantic-version: ["1.10", "2.0"]
3737
sqla-version: ["1.4", "2"]
3838
exclude:

.sourcery.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ rule_settings:
1515
- refactoring
1616
- suggestion
1717
- comment
18-
python_version: "3.8"
18+
python_version: "3.10"
1919

2020
rules: []
2121

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
autodoc_member_order = "bysource"
106106
autodoc_typehints_format = "short"
107107

108-
auto_pytabs_min_version = (3, 8)
108+
auto_pytabs_min_version = (3, 10)
109109
auto_pytabs_max_version = (3, 11)
110110
auto_pytabs_compat_mode = True
111111

docs/examples/configuration/test_example_11.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from polyfactory.factories import DataclassFactory
77

88
# Define a recursive type using forward reference
9-
RecursiveType = Union[list["RecursiveType"], int]
9+
RecursiveType = list["RecursiveType"] | int
1010

1111

1212
@dataclass

docs/reference/constants.rst

Lines changed: 0 additions & 9 deletions
This file was deleted.

polyfactory/constants.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,6 @@
33
from collections import abc, defaultdict, deque
44
from collections.abc import Iterable, Mapping, Sequence
55
from random import Random
6-
from typing import (
7-
Union,
8-
)
9-
10-
try:
11-
from types import UnionType
12-
except ImportError:
13-
UnionType = Union # type: ignore[misc,assignment]
14-
156

167
# Mapping of type annotations into concrete types.
178
TYPE_MAPPING = {
@@ -29,7 +20,6 @@
2920
abc.Mapping: dict,
3021
abc.Sequence: list,
3122
abc.Set: set,
32-
UnionType: Union,
3323
}
3424

3525

polyfactory/factories/odmantic_odm_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
msg = "odmantic is not installed"
1919
raise MissingDependencyException(msg) from e
2020

21-
T = TypeVar("T", bound=Union[Model, EmbeddedModel])
21+
T = TypeVar("T", bound=Model | EmbeddedModel)
2222

2323
if TYPE_CHECKING:
2424
from typing import TypeGuard

polyfactory/value_generators/constrained_strings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from polyfactory.value_generators.primitives import create_random_bytes, create_random_string
88
from polyfactory.value_generators.regex import RegexFactory
99

10-
T = TypeVar("T", bound=Union[bytes, str])
10+
T = TypeVar("T", bound=bytes | str)
1111

1212
if TYPE_CHECKING:
1313
from random import Random

pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ classifiers = [
1717
"License :: OSI Approved :: MIT License",
1818
"Natural Language :: English",
1919
"Operating System :: OS Independent",
20-
"Programming Language :: Python :: 3.9",
2120
"Programming Language :: Python :: 3.10",
2221
"Programming Language :: Python :: 3.11",
2322
"Programming Language :: Python :: 3.12",
@@ -36,7 +35,7 @@ version = "3.2.0"
3635
description = "Mock data generation factories"
3736
readme = "docs/PYPI_README.md"
3837
license = { text = "MIT" }
39-
requires-python = ">=3.9,<4.0"
38+
requires-python = ">=3.10,<4.0"
4039
dependencies = ["faker>=5.0.0", "typing-extensions>=4.6.0"]
4140

4241
[project.optional-dependencies]
@@ -184,7 +183,7 @@ exclude_lines = [
184183
[tool.ruff]
185184
line-length = 120
186185
src = ["polyfactory", "tests", "docs/examples"]
187-
target-version = "py39"
186+
target-version = "py310"
188187

189188
[tool.ruff.format]
190189
docstring-code-format = true

tests/constraints/test_list_constraints.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
import sys
21
from typing import Any
32

43
import pytest
54
from hypothesis import given
65
from hypothesis.strategies import integers
76

8-
from pydantic import VERSION
9-
107
from polyfactory.exceptions import ParameterException
118
from polyfactory.factories.pydantic_factory import ModelFactory, PydanticFieldMeta
129
from polyfactory.value_generators.constrained_collections import (
@@ -74,10 +71,6 @@ def test_handle_constrained_list_with_min_items(
7471
assert len(result) >= min_items
7572

7673

77-
@pytest.mark.skipif(
78-
sys.version_info < (3, 9) and VERSION.startswith("2"),
79-
reason="fails on python 3.8 with pydantic v2",
80-
)
8174
@pytest.mark.parametrize("t_type", tuple(ModelFactory.get_provider_map()))
8275
def test_handle_constrained_list_with_different_types(t_type: Any) -> None:
8376
field_meta = PydanticFieldMeta.from_type(list[t_type], name="test")

0 commit comments

Comments
 (0)