Conversation
Agent-Logs-Url: https://github.com/ShigureLab/watchfs/sessions/58f1d339-3811-4f7b-93e3-e13db85f0dce Co-authored-by: SigureMo <38436475+SigureMo@users.noreply.github.com>
| @@ -2,6 +2,7 @@ | |||
| "recommendations": [ | |||
| "ms-python.python", | |||
| "ms-python.vscode-pylance", | |||
There was a problem hiding this comment.
已删掉 Pylance 推荐,并顺手去掉了对应的 workspace python.analysis.* 设置,避免配置不一致。commit: 92b2d10
| type ExceptionHook = Callable[[type[BaseException], BaseException, TracebackType | None], object] | ||
|
|
||
| oldHook: ExceptionHook = sys.excepthook | ||
|
|
||
|
|
||
| def handle_uncaught_exception( | ||
| exctype: type[BaseException], exception: BaseException, trace: TracebackType | None | ||
| ) -> None: | ||
| oldHook(exctype, exception, trace) | ||
| if isinstance(exception, WatchFsBaseException): | ||
| sys.exit(exception.code.value) | ||
| raise SystemExit(exception.code.value) | ||
|
|
||
|
|
||
| sys.excepthook, oldHook = handleUncaughtException, sys.excepthook | ||
| sys.excepthook = handle_uncaught_exception |
There was a problem hiding this comment.
这里已经改回更接近原来那版的写法了:保留 handleUncaughtException / oldHook 这套结构,只补了让 ty 通过所需的参数类型和返回类型。commit: 92b2d10
Agent-Logs-Url: https://github.com/ShigureLab/watchfs/sessions/d42dbe9d-7495-4032-976f-a69bc166bf33 Co-authored-by: SigureMo <38436475+SigureMo@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ShigureLab/watchfs/sessions/d42dbe9d-7495-4032-976f-a69bc166bf33 Co-authored-by: SigureMo <38436475+SigureMo@users.noreply.github.com>
|
|
||
|
|
||
| def handleUncaughtException(exctype: type[Exception], exception: Exception, trace: TracebackType): | ||
| def handleUncaughtException( |
There was a problem hiding this comment.
| def handleUncaughtException( | |
| def handle_uncaught_exception( |
There was a problem hiding this comment.
已按建议改成 snake_case。commit: 4efc436
| def handleUncaughtException( | ||
| exctype: type[BaseException], exception: BaseException, trace: TracebackType | None | ||
| ) -> None: | ||
| oldHook(exctype, exception, trace) |
There was a problem hiding this comment.
| oldHook(exctype, exception, trace) | |
| old_hook(exctype, exception, trace) |
There was a problem hiding this comment.
已改成 old_hook。commit: 4efc436
| oldHook = sys.excepthook | ||
| sys.excepthook = handleUncaughtException |
There was a problem hiding this comment.
已经写回一行了。commit: 4efc436
Agent-Logs-Url: https://github.com/ShigureLab/watchfs/sessions/370ffd1c-7142-4d31-81e8-075ab705e7a2 Co-authored-by: SigureMo <38436475+SigureMo@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ShigureLab/watchfs/sessions/370ffd1c-7142-4d31-81e8-075ab705e7a2 Co-authored-by: SigureMo <38436475+SigureMo@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR migrates the repo’s type-checking workflow from Pyright to ty, updates the dev toolchain configuration accordingly, and includes a few small code tweaks to satisfy stricter typing checks.
Changes:
- Replace
pyrightwithtyacross dev dependencies, lockfile, andjust lintcommand. - Remove Pyright-specific configuration and adjust VS Code recommendations/settings.
- Minor typing-driven refactors (sync wrapper for
subprocess.run, explicit “unreachable” marker, exception hook typing cleanup, remove atype: ignoreimport).
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Drops pyright/nodeenv, adds ty to the locked dev dependency set. |
| pyproject.toml | Replaces pyright with ty in dev deps; removes [tool.pyright]; adjusts Ruff ignores. |
| justfile | Updates lint command to ty check --error-on-warning. |
| .vscode/settings.json | Removes Pylance type-checking/inlay-hints settings. |
| .vscode/extensions.json | Recommends astral-sh.ty and drops ms-python.vscode-pylance. |
| src/watchfs/targets.py | Introduces _run_command_sync wrapper and uses capture_output for typing clarity. |
| src/watchfs/mappings.py | Adds an explicit unreachable marker after structural pattern matching. |
| src/watchfs/exceptions.py | Renames/retokens excepthook handler, improves typing, uses SystemExit. |
| src/watchfs/main.py | Removes # type: ignore on watchfiles import. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "recommendations": [ | ||
| "ms-python.python", | ||
| "ms-python.vscode-pylance", | ||
| "astral-sh.ty", | ||
| "charliermarsh.ruff", | ||
| "esbenp.prettier-vscode", |
There was a problem hiding this comment.
PR description says to keep Pylance for editor inlay hints, but this change removes the ms-python.vscode-pylance recommendation entirely. Either re-add the Pylance extension here, or update the PR description to match the intended editor setup (and ensure inlay hints are still enabled somewhere if that’s desired).
| { | ||
| "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python", | ||
| "python.analysis.typeCheckingMode": "strict", | ||
| "python.analysis.inlayHints.functionReturnTypes": true, | ||
| "python.analysis.inlayHints.variableTypes": true, | ||
| "[python]": { | ||
| "editor.defaultFormatter": "charliermarsh.ruff" | ||
| } |
There was a problem hiding this comment.
PR description mentions keeping Pylance for inlay hints, but these settings removed the explicit inlay-hint options (and strict typeCheckingMode). If inlay hints are still intended as part of the recommended setup, consider keeping the inlay-hint settings (or documenting the new defaults) so contributors get consistent editor behavior.
Summary
pyrightwithtyin the dev dependency set, lockfile, and lint commandtyVS Code extensionty --error-on-warningsurfaced so local lint, tests, and build stay greenValidation
uv run ruff format --check .npx --yes prettier --check '**/*.md'uv run ty check --error-on-warning src/watchfs testsuv run ruff check .uv run pytest --reruns 3 --reruns-delay 1uv build