Repository navigation
fix: resolve python formatting failure and ignore local memories - #62
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Resolves the
python-formattingjob failure in run43672620290, which ranhatch fmt src tests --checkand failed with:Root cause
hooks.pystarts withfrom __future__ import annotations, so every annotation in that module is a string and is never evaluated at runtime.RouteStateis only used in annotations there (_route_state_contextand_use_route_state's return type), which makes the runtime import dead weight and triggers ruff'sTC001.Fix
RouteStateimport into the existingTYPE_CHECKINGblock insrc/reactpy_router/hooks.py.src/reactpy_router/routers.pyinstantiatesRouteState(...)at runtime, so it now imports it directly fromreactpy_router.typesinstead of re-exporting it throughhooks. That keeps a single, correct source of truth for the symbol and avoids relying on an incidental re-export.memories/*entry to.gitignoreso local LLM artifacts are not committed.Verification
hatch fmt src tests --check—All checks passed!and13 files already formattedruff 0.13.2(the CI version) as well asruff 0.17.5hatch run python:type_check—0 errors, 0 warnings, 0 informationshatch test -py=3.13 --headless—30 passedChecklist
Please update this checklist as you complete each item:
By submitting this pull request I agree that all contributions comply with this project's open source license(s).