From 04caa0d8d2d2c298a9b56c997dc3d630477b09db Mon Sep 17 00:00:00 2001 From: Mark Bakhit <16909269+Archmonger@users.noreply.github.com> Date: Sat, 14 Nov 2026 19:42:47 -0800 Subject: [PATCH] fix: resolve python formatting failure and ignore local memories CI's `hatch fmt src tests --check` failed with: TC001 Move application import `reactpy_router.types.RouteState` into a type-checking block --> src/reactpy_router/hooks.py:9:34 `RouteState` is only referenced from annotations in `hooks.py`, where `from __future__ import annotations` makes those annotations strings, so the import belongs in the `TYPE_CHECKING` block. `routers.py` constructs `RouteState(...)` at runtime, so it now imports it directly from `reactpy_router.types` rather than re-exporting it through `hooks`. Also adds a `memories/*` entry to `.gitignore` so local LLM artifacts stay out of the repository. --- .gitignore | 3 +++ src/reactpy_router/hooks.py | 4 ++-- src/reactpy_router/routers.py | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 12271fc..67bb9a4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# --- LLM Artifacts --- +memories/* + # --- DOCS --- docs/site diff --git a/src/reactpy_router/hooks.py b/src/reactpy_router/hooks.py index 5d3d438..f361141 100644 --- a/src/reactpy_router/hooks.py +++ b/src/reactpy_router/hooks.py @@ -6,13 +6,13 @@ from reactpy import create_context, use_context, use_location -from reactpy_router.types import RouteState - if TYPE_CHECKING: from collections.abc import Callable from reactpy.types import Context + from reactpy_router.types import RouteState + _route_state_context: Context[RouteState | None] = create_context(None) diff --git a/src/reactpy_router/routers.py b/src/reactpy_router/routers.py index f0bf9bf..a191efa 100644 --- a/src/reactpy_router/routers.py +++ b/src/reactpy_router/routers.py @@ -11,8 +11,9 @@ from reactpy.types import Component, Connection, Location, VdomDict from reactpy_router.components import History -from reactpy_router.hooks import FormDataState, RouteState, _form_data_state_context, _route_state_context +from reactpy_router.hooks import FormDataState, _form_data_state_context, _route_state_context from reactpy_router.resolvers import ReactPyResolver +from reactpy_router.types import RouteState if TYPE_CHECKING: from collections.abc import Iterator, Sequence