Skip to content

Commit 680c7ef

Browse files
authored
feat: add support for Python 3.15 (#2294)
Adds Python 3.15 to the lint, type check and unit test matrices, uploads unit test coverage from 3.15, and adds the 3.15 classifier. `lupa` has no cp315 wheels yet and does not build on Windows, so Windows + 3.15 installs `fakeredis` without the `lua` extra, and the Redis RQ tests skip when `lupa` is missing. Restoring it is tracked in #2326. *✍️ Drafted by Claude Code*
1 parent 357acd5 commit 680c7ef

5 files changed

Lines changed: 123 additions & 70 deletions

File tree

‎.github/workflows/_checks.yaml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ jobs:
4141
name: Lint check
4242
uses: apify/workflows/.github/workflows/python_lint_check.yaml@main
4343
with:
44-
python_versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]'
44+
python_versions: '["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]'
4545

4646
type_check:
4747
name: Type check
4848
uses: apify/workflows/.github/workflows/python_type_check.yaml@main
4949
with:
50-
python_versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]'
50+
python_versions: '["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]'
5151

5252
markdown_lint_check:
5353
name: Markdown lint check
@@ -135,9 +135,9 @@ jobs:
135135
uses: apify/workflows/.github/workflows/python_unit_tests.yaml@main
136136
secrets: inherit
137137
with:
138-
python_versions: '["3.10", "3.11", "3.12", "3.13", "3.14"]'
138+
python_versions: '["3.10", "3.11", "3.12", "3.13", "3.14", "3.15"]'
139139
operating_systems: '["ubuntu-latest", "windows-latest", "macos-latest"]'
140-
python_version_for_codecov: "3.14"
140+
python_version_for_codecov: "3.15"
141141
operating_system_for_codecov: ubuntu-latest
142142
tests_concurrency: "8"
143143

‎pyproject.toml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ classifiers = [
2121
"Programming Language :: Python :: 3.12",
2222
"Programming Language :: Python :: 3.13",
2323
"Programming Language :: Python :: 3.14",
24+
"Programming Language :: Python :: 3.15",
2425
"Topic :: Software Development :: Libraries",
2526
]
2627
keywords = [
@@ -124,7 +125,8 @@ dev = [
124125
# drops Python 3.10 (https://github.com/apify/crawlee-python/issues/1721), remove this constraint.
125126
"apify_client<3.0.0", # For e2e tests.
126127
"build<2.0.0", # For e2e tests.
127-
"fakeredis[probabilistic,json,lua]<3.0.0",
128+
"fakeredis[probabilistic,json,lua]<3.0.0; python_version != '3.15' or sys_platform != 'win32'",
129+
"fakeredis[probabilistic,json]<3.0.0; python_version == '3.15' and sys_platform == 'win32'",
128130
"filelock<5.0.0", # For e2e tests.
129131
"poethepoet<1.0.0",
130132
"pre-commit<5.0.0",
@@ -325,6 +327,7 @@ apify-client = false
325327
apify-shared = false
326328
apify_fingerprint_datapoints = false
327329
crawlee = false
330+
impit = false
328331

329332
# Run tasks with: uv run poe <task>
330333
[tool.poe.tasks]

‎tests/unit/storage_clients/_redis/test_redis_rq_client.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import asyncio
44
import json
55
from datetime import timedelta
6+
from importlib.util import find_spec
67
from typing import TYPE_CHECKING
78
from unittest.mock import AsyncMock, MagicMock, Mock, patch
89

@@ -22,6 +23,10 @@
2223
from crawlee.storage_clients._redis import RedisRequestQueueClient
2324

2425

26+
# The Redis RQ client runs Lua scripts, which `fakeredis` executes only with `lupa` installed.
27+
pytestmark = pytest.mark.skipif(find_spec('lupa') is None, reason='`lupa` is not installed')
28+
29+
2530
@pytest.fixture(params=['default', 'bloom'])
2631
async def rq_client(
2732
redis_client: FakeAsyncRedis,

‎tests/unit/storages/conftest.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
from importlib.util import find_spec
34
from typing import TYPE_CHECKING
45

56
import pytest
@@ -19,6 +20,16 @@
1920
from fakeredis import FakeAsyncRedis
2021

2122

23+
def pytest_collection_modifyitems(items: list[pytest.Item]) -> None:
24+
"""Skip the Redis request queue cases when `lupa` is missing, since the Redis RQ client runs Lua scripts."""
25+
if find_spec('lupa') is not None:
26+
return
27+
for item in items:
28+
callspec = getattr(item, 'callspec', None)
29+
if item.path.name == 'test_request_queue.py' and callspec and callspec.params.get('storage_client') == 'redis':
30+
item.add_marker(pytest.mark.skip(reason='`lupa` is not installed'))
31+
32+
2233
@pytest.fixture(params=['memory', 'file_system', 'sql', 'redis'])
2334
async def storage_client(
2435
request: pytest.FixtureRequest,

0 commit comments

Comments
 (0)