Skip to content

Commit 1548a3d

Browse files
committed
build: switch versioning source to version.py, support python 3.14
1 parent a97de62 commit 1548a3d

26 files changed

+217
-98
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Upcoming
44

55
- refactor: use custom value `NOT_SET = object()` instead of `None` to signal the absence of a value for the `default_value` parameter in `AutorunOptions` and internally in `Autorun` class for properties storing last selector result and last call result
6+
- build: switch versioning source to `version.py`, support Python 3.14
67

78
## Version 0.24.0
89

demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ruff: noqa: D100, D101, D102, D103, D104, D107, A003, T201
1+
# ruff: noqa: D100, D101, D103, T201
22
from __future__ import annotations
33

44
import time

pyproject.toml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,23 @@ classifiers = [
1313
"Programming Language :: Python :: 3.11",
1414
"Programming Language :: Python :: 3.12",
1515
"Programming Language :: Python :: 3.13",
16+
"Programming Language :: Python :: 3.14",
1617
"Programming Language :: Python :: 3 :: Only",
1718
]
1819

19-
[tool.uv]
20-
dev-dependencies = [
20+
[dependency-groups]
21+
dev = [
22+
"hatch-vcs >= 0.5.0",
2123
"poethepoet >= 0.24.4",
22-
"pyright >= 1.1.401",
23-
"ruff >= 0.11.8",
2424
"pytest >= 8.1.1",
2525
"pytest-cov >= 4.1.0",
26-
"pytest-timeout >= 2.3.1",
2726
"pytest-mock >= 3.14.0",
27+
"pytest-timeout >= 2.3.1",
28+
"ruff >= 0.14.8",
2829
"tenacity >= 8.2.3",
30+
"cython >= 3.0.0",
31+
"setuptools >= 68.0.0",
32+
"pyright>=1.1.407",
2933
]
3034

3135
[project.urls]
@@ -39,14 +43,13 @@ requires = ["hatchling", "hatch-vcs"]
3943
build-backend = "hatchling.build"
4044

4145
[tool.hatch.version]
42-
source = "vcs"
46+
source = "code"
47+
path = "version.py"
48+
expression = "get_version()"
4349

4450
[tool.hatch.build.hooks.vcs]
4551
version-file = "redux/_version.py"
4652

47-
[tool.hatch.version.raw-options]
48-
local_scheme = "setup_scm_schemes:local_scheme"
49-
5053
[tool.hatch.build]
5154
packages = ["redux", "redux_pytest"]
5255

@@ -78,7 +81,8 @@ inline-quotes = "single"
7881
multiline-quotes = "double"
7982

8083
[tool.ruff.lint.per-file-ignores]
81-
"tests/*" = ["S101", "PLR0915", "PLR2004"]
84+
"tests/*" = ["S101", "PLR0915", "PLR2004", "PLC0415"]
85+
"redux_pytest/*" = ["PLC0415"]
8286

8387
[tool.ruff.format]
8488
quote-style = 'single'

redux/basic_types.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ruff: noqa: A003, D100, D101, D102, D103, D104, D105, D107
1+
# ruff: noqa: D100, D101, D102, D103, D107
22
from __future__ import annotations
33

44
from collections.abc import Awaitable, Callable, Coroutine, Sequence
@@ -118,18 +118,6 @@ class EventMiddleware(Protocol, Generic[Event]):
118118
def __call__(self: EventMiddleware, event: Event) -> Event | None: ...
119119

120120

121-
def default_autorun() -> type[Autorun]:
122-
from redux.autorun import Autorun
123-
124-
return Autorun
125-
126-
127-
def default_side_effect_runner() -> type[SideEffectRunner]:
128-
from redux.side_effect_runner import SideEffectRunner
129-
130-
return SideEffectRunner
131-
132-
133121
class StoreOptions(Immutable, Generic[Action, Event]):
134122
auto_init: bool = False
135123
side_effect_threads: int = 1
@@ -143,15 +131,27 @@ class StoreOptions(Immutable, Generic[Action, Event]):
143131
task_creator: TaskCreator | None = None
144132
on_finish: Callable[[], Any] | None = None
145133
grace_time_in_seconds: float = 1
146-
autorun_class: type[Autorun] = field(default_factory=default_autorun)
134+
autorun_class: type[Autorun] = field(
135+
default_factory=lambda: __import__(
136+
'redux.autorun',
137+
fromlist=['redux'],
138+
).Autorun,
139+
)
147140
side_effect_runner_class: type[SideEffectRunner] = field(
148-
default_factory=default_side_effect_runner,
141+
default_factory=lambda: __import__(
142+
'redux.side_effect_runner',
143+
fromlist=['redux'],
144+
).SideEffectRunner,
149145
)
150146

151147

152148
# Autorun
153149

154-
AutoAwait = TypeVar('AutoAwait', bound=Literal[True, False, None], infer_variance=True)
150+
AutoAwait = TypeVar(
151+
'AutoAwait',
152+
bound=(Literal[True, False] | None),
153+
infer_variance=True,
154+
)
155155

156156
NOT_SET = object()
157157

@@ -168,10 +168,10 @@ class AutorunOptionsType(Immutable, Generic[ReturnType, AutoAwait]):
168168

169169
@overload
170170
def __init__(
171-
self: AutorunOptionsType[ReturnType, Literal[None]], # type: ignore[reportInvalidTypeVar]
171+
self: AutorunOptionsType[ReturnType, None], # type: ignore[reportInvalidTypeVar]
172172
*,
173173
default_value: ReturnType | None = None,
174-
auto_await: Literal[None] | None = None,
174+
auto_await: None = None,
175175
initial_call: bool = True,
176176
reactive: bool = True,
177177
memoization: bool = True,
@@ -275,12 +275,12 @@ def __call__(
275275
class AutorunDecorator(Protocol, Generic[ReturnType, SelectorOutput, AutoAwait]):
276276
@overload
277277
def __call__(
278-
self: AutorunDecorator[ReturnType, SelectorOutput, Literal[None]],
278+
self: AutorunDecorator[ReturnType, SelectorOutput, None],
279279
func: Callable[Concatenate[SelectorOutput, Args], Awaitable[ReturnType]],
280280
) -> AutorunReturnType[Args, None]: ...
281281
@overload
282282
def __call__(
283-
self: AutorunDecorator[ReturnType, SelectorOutput, Literal[None]],
283+
self: AutorunDecorator[ReturnType, SelectorOutput, None],
284284
func: Callable[
285285
Concatenate[MethodSelf, SelectorOutput, Args],
286286
Awaitable[ReturnType],
@@ -289,15 +289,15 @@ def __call__(
289289

290290
@overload
291291
def __call__(
292-
self: AutorunDecorator[ReturnType, SelectorOutput, Literal[None]],
292+
self: AutorunDecorator[ReturnType, SelectorOutput, None],
293293
func: Callable[
294294
Concatenate[SelectorOutput, Args],
295295
ReturnType,
296296
],
297297
) -> AutorunReturnType[Args, ReturnType]: ...
298298
@overload
299299
def __call__(
300-
self: AutorunDecorator[ReturnType, SelectorOutput, Literal[None]],
300+
self: AutorunDecorator[ReturnType, SelectorOutput, None],
301301
func: Callable[
302302
Concatenate[MethodSelf, SelectorOutput, Args],
303303
ReturnType,

redux/combine_reducers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ruff: noqa: A003, D100, D101, D102, D103, D104, D105, D107
1+
# ruff: noqa: D100, D103
22
from __future__ import annotations
33

44
import copy

redux/main.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import asyncio
66
import inspect
77
import queue
8+
import time
89
import weakref
910
from collections import defaultdict
1011
from collections.abc import Awaitable, Iterable, Sequence
@@ -62,7 +63,7 @@
6263
from collections.abc import Callable
6364

6465

65-
class Store(Generic[State, Action, Event], SerializationMixin):
66+
class Store(SerializationMixin, Generic[State, Action, Event]):
6667
"""Redux store for managing state and side effects."""
6768

6869
def __init__(
@@ -284,8 +285,6 @@ def unsubscribe() -> None:
284285

285286
def _wait_for_store_to_finish(self: Store[State, Action, Event]) -> None:
286287
"""Wait for the store to finish."""
287-
import time
288-
289288
while True:
290289
if (
291290
self._actions == []

redux_pytest/fixtures/event_loop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ruff: noqa: D100, D101, D102, D103, D104, D107
1+
# ruff: noqa: D100, D101, D102, D103, D107
22
from __future__ import annotations
33

44
import asyncio

setup_scm_schemes.py

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

tests/test_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ruff: noqa: D100, D101, D102, D103, D104, D107
1+
# ruff: noqa: D100, D101, D103
22
from __future__ import annotations
33

44
import asyncio

tests/test_autorun.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ruff: noqa: D100, D101, D102, D103, D104, D107
1+
# ruff: noqa: D100, D101, D103
22
from __future__ import annotations
33

44
import inspect

0 commit comments

Comments
 (0)