Skip to content

Commit e1175f6

Browse files
authored
chore: Bump minimum Python version to 3.10 (#493)
Closes: #151
1 parent 0a3bd3f commit e1175f6

18 files changed

+54
-349
lines changed

.github/workflows/pre_release.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,26 @@ jobs:
3232
name: Lint check
3333
uses: apify/workflows/.github/workflows/python_lint_check.yaml@main
3434
with:
35-
python-versions: '["3.9", "3.10", "3.11", "3.12", "3.13"]'
35+
python-versions: '["3.10", "3.11", "3.12", "3.13"]'
3636

3737
type_check:
3838
name: Type check
3939
uses: apify/workflows/.github/workflows/python_type_check.yaml@main
4040
with:
41-
python-versions: '["3.9", "3.10", "3.11", "3.12", "3.13"]'
41+
python-versions: '["3.10", "3.11", "3.12", "3.13"]'
4242

4343
unit_tests:
4444
name: Unit tests
4545
uses: apify/workflows/.github/workflows/python_unit_tests.yaml@main
4646
with:
47-
python-versions: '["3.9", "3.10", "3.11", "3.12", "3.13"]'
47+
python-versions: '["3.10", "3.11", "3.12", "3.13"]'
4848

4949
integration_tests:
5050
name: Integration tests
5151
uses: apify/workflows/.github/workflows/python_integration_tests.yaml@main
5252
secrets: inherit
5353
with:
54-
python-versions: '["3.9", "3.13"]'
54+
python-versions: '["3.10", "3.13"]'
5555

5656
update_changelog:
5757
name: Update changelog

.github/workflows/release.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,26 @@ jobs:
4343
name: Lint check
4444
uses: apify/workflows/.github/workflows/python_lint_check.yaml@main
4545
with:
46-
python-versions: '["3.9", "3.10", "3.11", "3.12", "3.13"]'
46+
python-versions: '["3.10", "3.11", "3.12", "3.13"]'
4747

4848
type_check:
4949
name: Type check
5050
uses: apify/workflows/.github/workflows/python_type_check.yaml@main
5151
with:
52-
python-versions: '["3.9", "3.10", "3.11", "3.12", "3.13"]'
52+
python-versions: '["3.10", "3.11", "3.12", "3.13"]'
5353

5454
unit_tests:
5555
name: Unit tests
5656
uses: apify/workflows/.github/workflows/python_unit_tests.yaml@main
5757
with:
58-
python-versions: '["3.9", "3.10", "3.11", "3.12", "3.13"]'
58+
python-versions: '["3.10", "3.11", "3.12", "3.13"]'
5959

6060
integration_tests:
6161
name: Integration tests
6262
uses: apify/workflows/.github/workflows/python_integration_tests.yaml@main
6363
secrets: inherit
6464
with:
65-
python-versions: '["3.9", "3.13"]'
65+
python-versions: '["3.10", "3.13"]'
6666

6767
update_changelog:
6868
name: Update changelog

.github/workflows/run_code_checks.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ jobs:
1111
name: Lint check
1212
uses: apify/workflows/.github/workflows/python_lint_check.yaml@main
1313
with:
14-
python-versions: '["3.9", "3.10", "3.11", "3.12", "3.13"]'
14+
python-versions: '["3.10", "3.11", "3.12", "3.13"]'
1515

1616
type_check:
1717
name: Type check
1818
uses: apify/workflows/.github/workflows/python_type_check.yaml@main
1919
with:
20-
python-versions: '["3.9", "3.10", "3.11", "3.12", "3.13"]'
20+
python-versions: '["3.10", "3.11", "3.12", "3.13"]'
2121

2222
unit_tests:
2323
name: Unit tests
2424
uses: apify/workflows/.github/workflows/python_unit_tests.yaml@main
2525
with:
26-
python-versions: '["3.9", "3.10", "3.11", "3.12", "3.13"]'
26+
python-versions: '["3.10", "3.11", "3.12", "3.13"]'
2727

2828
docs_check:
2929
name: Docs check
@@ -35,4 +35,4 @@ jobs:
3535
uses: apify/workflows/.github/workflows/python_integration_tests.yaml@main
3636
secrets: inherit
3737
with:
38-
python-versions: '["3.9", "3.13"]'
38+
python-versions: '["3.10", "3.13"]'

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Here you'll find a contributing guide to get started with development.
44

55
## Environment
66

7-
For local development, it is required to have Python 3.9 (or a later version) installed.
7+
For local development, it is required to have Python 3.10 (or a later version) installed.
88

99
We use [uv](https://docs.astral.sh/uv/) for project management. Install it and set up your IDE accordingly.
1010

docs/01_overview/02_running_actors_locally.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ In this page, you'll learn how to create and run Apify Actors locally on your co
1111

1212
## Requirements
1313

14-
The Apify SDK requires Python version 3.9 or above to run Python Actors locally.
14+
The Apify SDK requires Python version 3.10 or above to run Python Actors locally.
1515

1616
## Creating your first Actor
1717

pyproject.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@ description = "Apify SDK for Python"
99
authors = [{ name = "Apify Technologies s.r.o.", email = "[email protected]" }]
1010
license = { file = "LICENSE" }
1111
readme = "README.md"
12-
requires-python = ">=3.9"
12+
requires-python = ">=3.10"
1313
classifiers = [
1414
"Development Status :: 5 - Production/Stable",
1515
"Environment :: Console",
1616
"Intended Audience :: Developers",
1717
"License :: OSI Approved :: Apache Software License",
1818
"Operating System :: OS Independent",
19-
"Programming Language :: Python :: 3.9",
2019
"Programming Language :: Python :: 3.10",
2120
"Programming Language :: Python :: 3.11",
2221
"Programming Language :: Python :: 3.12",
@@ -188,7 +187,7 @@ asyncio_mode = "auto"
188187
timeout = 1200
189188

190189
[tool.mypy]
191-
python_version = "3.9"
190+
python_version = "3.10"
192191
plugins = ["pydantic.mypy"]
193192
files = ["src", "tests", "docs", "website"]
194193
check_untyped_defs = true
@@ -215,7 +214,7 @@ module = [
215214
ignore_missing_imports = true
216215

217216
[tool.basedpyright]
218-
pythonVersion = "3.9"
217+
pythonVersion = "3.10"
219218
typeCheckingMode = "standard"
220219
include = ["src", "tests", "docs", "website"]
221220

src/apify/_actor.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import sys
66
from contextlib import suppress
77
from datetime import datetime, timedelta, timezone
8-
from typing import TYPE_CHECKING, Any, Callable, Literal, TypeVar, cast, overload
8+
from typing import TYPE_CHECKING, Any, Literal, TypeVar, cast, overload
99

1010
from lazy_object_proxy import Proxy
1111
from more_itertools import flatten
@@ -39,6 +39,7 @@
3939

4040
if TYPE_CHECKING:
4141
import logging
42+
from collections.abc import Callable
4243
from types import TracebackType
4344

4445
from typing_extensions import Self

src/apify/_charging.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from dataclasses import dataclass
55
from datetime import datetime, timezone
66
from decimal import Decimal
7-
from typing import TYPE_CHECKING, Protocol, Union
7+
from typing import TYPE_CHECKING, Protocol
88

99
from pydantic import TypeAdapter
1010

@@ -23,8 +23,7 @@
2323

2424
from apify._configuration import Configuration
2525

26-
27-
run_validator: TypeAdapter[ActorRun | None] = TypeAdapter(Union[ActorRun, None])
26+
run_validator = TypeAdapter[ActorRun | None](ActorRun | None)
2827

2928

3029
@docs_group('Interfaces')

src/apify/_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from apify._utils import docs_group
1414

1515
if TYPE_CHECKING:
16-
from typing_extensions import TypeAlias
16+
from typing import TypeAlias
1717

1818

1919
@docs_group('Data structures')

src/apify/_platform_event_manager.py

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import asyncio
44
from datetime import datetime
5-
from typing import TYPE_CHECKING, Annotated, Any, Literal, Union
5+
from typing import TYPE_CHECKING, Annotated, Any, Literal
66

77
import websockets.asyncio.client
88
from pydantic import BaseModel, Discriminator, Field, TypeAdapter
@@ -113,25 +113,10 @@ class UnknownEvent(BaseModel):
113113
data: Annotated[dict[str, Any], Field(default_factory=dict)]
114114

115115

116-
EventMessage = Union[
117-
PersistStateEvent,
118-
SystemInfoEvent,
119-
MigratingEvent,
120-
AbortingEvent,
121-
ExitEvent,
122-
EventWithoutData,
123-
]
124-
125-
126-
event_data_adapter: TypeAdapter[EventMessage | DeprecatedEvent | UnknownEvent] = TypeAdapter(
127-
Union[
128-
Annotated[
129-
EventMessage,
130-
Discriminator('name'),
131-
],
132-
DeprecatedEvent,
133-
UnknownEvent,
134-
]
116+
EventMessage = PersistStateEvent | SystemInfoEvent | MigratingEvent | AbortingEvent | ExitEvent | EventWithoutData
117+
118+
event_data_adapter = TypeAdapter[EventMessage | DeprecatedEvent | UnknownEvent](
119+
Annotated[EventMessage, Discriminator('name')] | DeprecatedEvent | UnknownEvent
135120
)
136121

137122

0 commit comments

Comments
 (0)