Repository navigation
chore: adopt toml-sort layout and ignore TC001-TC003 - #1
Merged
Merged
Conversation
Recovered from the working tree; not authored in this session. - pyproject.toml: wholesale toml-sort reformat (tables alphabetised, comment alignment collapsed), new [tool.tomlsort] plus per-table overrides, [dependency-groups] repositioned, and ruff lint.isort required-imports = ["from __future__ import annotations"] - pyproject.toml/uv.lock: add toml-sort and uv-sort as dev dependencies - CLAUDE.md: prose rewrite Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QJeBLNA9ybmQvv5REMDkrc
The previous commit adds lint.isort.required-imports = ["from __future__ import annotations"]. flake8-type-checking (TC, selected via extend-select) moves annotation-only imports into TYPE_CHECKING blocks, which raises NameError at runtime on Python 3.10-3.13 for anything that resolves annotations at runtime. The two must never both be active, so neutralise TC001-TC003. Spelling is codes, not names: uv.lock resolves ruff 0.14.8 and .pre-commit-config.yaml pins ruff-pre-commit at v0.14.4, both predating rule-codes-in-selectors/RUF201 (`uvx ruff@0.14.8 rule RUF201` returns "error: invalid value 'RUF201'"). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QJeBLNA9ybmQvv5REMDkrc
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
basedpyright pulls nodejs-wheel-binaries, which has no wheel for macOS 12 and whose CMake source build fails, making `uv sync` with the dev group impossible locally. mypy already covers type checking in CI (.github/workflows/test.yml typecheck job). Removes the dev-group dependency via `uv remove` (uv.lock regenerated) and the basedpyright-prek-mirror hook from .pre-commit-config.yaml. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QJeBLNA9ybmQvv5REMDkrc
The dependency and hook are gone, but IDEs and one-off CLI runs still pick up a [tool.basedpyright] stanza. Replace the full basic-mode configuration with typeCheckingMode = "off" so nothing second-guesses mypy, which is this repo's type checker (.github/workflows/test.yml typecheck job). Shape and comment follow the house style in skilllint pyproject.toml:312-319. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QJeBLNA9ybmQvv5REMDkrc
Bumps markdownlint-cli2 v0.19.1->v0.23.2, ruff-pre-commit v0.14.4->v0.16.5, sync-pre-commit-deps v0.0.3->v0.0.5, mirrors-prettier v3.1.0->v4.0.0-alpha.8 and shellcheck-py v0.11.0.1->v0.11.0.1-1. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QJeBLNA9ybmQvv5REMDkrc
Swaps the type checker to ty across dependency, config, hook and CI so a single checker owns type checking: - `uv remove mypy` / `uv add --group dev ty` (uv.lock regenerated). - [tool.ty.src] include = ["packages"] — the only source directory in this repo, and the sole target of the CI typecheck job. No [tool.ty.environment]: that exists in skilllint only for its scripts/ sibling-import layout, which this repo does not have. - [tool.mypy] reduced to exclude = [".*"] so editor-launched mypy stays quiet rather than second-guessing ty; comment shape follows skilllint pyproject.toml:312-319. - .pre-commit-config.yaml: local mypy hook replaced by a local ty hook, following skilllint .pre-commit-config.yaml:120-139. - .github/workflows/test.yml typecheck job: `uv run mypy packages/ --show-error-codes` -> `uv run ty check packages/`. ty reports 0 errors on packages/, matching mypy's previous 0. No suppressions added. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QJeBLNA9ybmQvv5REMDkrc
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.
Provenance — read this first
Commit 1 (
58fdfab) is pre-existing uncommitted work recovered from the working tree onmain. It was not authored in this task. It was sitting unstaged and orphaned; it is committed here verbatim, unmodified, so it is recoverable and reviewable. It has not been reformatted, corrected, or extended.Commit 2 (
bae1c1f) is the only work authored here.Commit 1 —
58fdfabrecovered workpyproject.toml(+373 lines changed): wholesaletoml-sortreformat — tables alphabetised, comment alignment collapsed; new[tool.tomlsort]plus ~10[tool.tomlsort.overrides.*]tables;[dependency-groups]repositioned;toml-sortanduv-sortadded as dev dependencies.lint.isort.required-imports = ["from __future__ import annotations"], which is absent fromorigin/main.uv.lock(+205 lines): matches the new dev dependencies. Does not moveruff— still0.14.8, same asorigin/main.CLAUDE.md: full prose rewrite.Commit 2 —
bae1c1fTC001-TC003 ignoresTC(flake8-type-checking) is inextend-select(pyproject.toml:104). Convention here is thatrequired-imports = ["from __future__ import annotations"]and the TC rules must never both be active: TC moves annotation-only imports intoTYPE_CHECKING, which raisesNameErrorat runtime on Python 3.10-3.13 for anything resolving annotations at runtime. Commit 1 introducesrequired-imports, so it introduces the hazard; these three ignores neutralise it.Spelling is codes, not names.
uv.lockresolves ruff0.14.8and.pre-commit-config.yaml:56pinsruff-pre-commitatv0.14.4— both predaterule-codes-in-selectors/RUF201. Confirmed against the modified lock:uvx ruff@0.14.8 rule RUF201returnserror: invalid value 'RUF201', whileuvx ruff@0.14.8 rule TC001resolves.No suppressions beyond these three entries.
Gate result
The blocking jobs in
.github/workflows/test.ymlareformat,lint,typecheck,test-linux,test-macos,test-windows. There is no pytest job, despite[tool.pytest.ini_options]existing (pyproject.toml:41) — and itstestpaths = ["tests"](pyproject.toml:50) names a directory that does not exist; the repo hastest/.origin/mainuv run ruff format --check packages/uv run ruff check --output-format=github packages/uv run mypy packages/ --show-error-codesuv run ensure-uvuv run python -c "from ensure_uv import main; ..."Baseline was measured in a throwaway
git worktreeonorigin/main(3301c47) and was fully green — nothing is already failing upstream. The worktree has been removed.Behavioural change the recovered work causes — not fixed here
[tool.ruff] fix = true(pyproject.toml:53), withunsafe-fixes = true(:56). Because commit 1 addsrequired-imports, thelintjob now finds anI002violation inpackages/ensure_uv/__init__.py(it lacksfrom __future__ import annotations;main.pyandversion.pyhave it) and silently rewrites that file in place, then exits 0. So the gate passes, but CI's checkout is mutated and the committed source is notrequired-imports-clean.Per instruction this was left exactly as the work was found. The one-line fix, if wanted, is adding
from __future__ import annotationstopackages/ensure_uv/__init__.py.TYPE_CHECKINGauditExactly one hit repo-wide:
test/setup_test_project.py:17-20,from collections.abc import Sequenceunderif TYPE_CHECKING:, used only in annotations (Sequence[str]) — a TC003 shape. Runtime-safe as written, since that file hasfrom __future__ import annotationsat line 8. It is outside the gate's scope: every CI command targetspackages/only. Nothing inpackages/has aTYPE_CHECKINGblock.Note on local verification
Local
uv sync(full dev group) cannot complete on the author's machine:basedpyrightpullsnodejs-wheel-binaries, which has no wheel for this platform and fails its CMake source build. The disk is also at 100%. Both are environment problems, unrelated to this branch, and they affected baseline and branch identically. Gate tools were therefore run viauvxpinned to the lockfile versions (ruff@0.14.8,mypy@1.19.0) withuv sync --no-devfor the entry-point jobs. The localprekhooks could not install for the same reason, so both commits used--no-verify; CI is the authoritative check.Do not merge without review.
Second pass — basedpyright removal, prek autoupdate, mypy → ty
Four further commits on this branch, each self-contained.
245283cchore(deps): removebasedpyrightdependency + hook36ea52fchore(config): replace the[tool.basedpyright]config withtypeCheckingMode = "off"a0082ecchore(prek):prek autoupdate091cb0crefactor(typing): replace mypy with Astralty245283c— basedpyright removedRemoved via
uv remove --group dev basedpyright(never hand-edited;uv.lockregenerated), plus thebasedpyright-prek-mirrorhook block from.pre-commit-config.yaml.This fixes local
uv sync. The note at the bottom of the original body was correct:basedpyrightpullsnodejs-wheel-binaries, which has no wheel for macOS 12 and whose CMake source build fails. Measured this session:uv syncfails —*** CMake build failed, with uv's own hint:`nodejs-wheel-binaries` (v24.11.1) was included because `ensure-uv:dev` (v0.1.0) depends on `basedpyright` (v1.35.0) which depends on `nodejs-wheel-binaries`uv sync→Resolved 32 packages,Checked 25 packages, exit 0.Consequently the gate in this pass was run natively via
uv run …, not via pinneduvxinvocations as in the first pass.The
uv.lockdiff (+20/−50) contains no unrelated version bumps — only the removal ofbasedpyrightandnodejs-wheel-binaries, plus marker simplification that falls out of dropping them.36ea52f— basedpyright disabled rather than configuredCorrection to a premise carried into this task: a
[tool.basedpyright]stanza did already exist (pyproject.toml:187,typeCheckingMode = "basic", ten keys). It was replaced wholesale, not added.091cb0c— mypy → tyuv remove mypy,uv add --group dev ty→ty>=0.0.75(0.0.75 confirmed as latest on PyPI this session).[tool.ty.src] include = ["packages"].packages/is the only source directory in this repo and the sole target of the CI typecheck job. No[tool.ty.environment]— that table exists in the reference repo purely for ascripts/sibling-import layout this repo does not have, so it would be dead config here.[tool.mypy]reduced toexclude = [".*"], keeping editor-launched mypy quiet without a second checker second-guessing ty..pre-commit-config.yaml: the localmypyhook replaced by a localtyhook (entry: uv run -q ty check,language: system,pass_filenames: true).typecheckjob (test.yml:89):uv run mypy packages/ --show-error-codes→uv run ty check packages/.Error count: ty reports 0, mypy reported 0. No suppressions were added — no
# type: ignore, no# ty: ignore, nocast(), no loosened config.The ty hook uses
pass_filenames, which bypasses[tool.ty.src], so it also reachestest/setup_test_project.py. Checked explicitly:uv run ty check test/*.py→All checks passed!.uv run toml-sort --check pyproject.tomlexits 0, so the new table placement matches the[tool.tomlsort]ordering already committed in58fdfab(which already listedtool.tyinsort_firstand carried[tool.tomlsort.overrides."tool.ty"]).a0082ec— prek autoupdatesync-pre-commit-depsv0.0.3v0.0.5ruff-pre-commitv0.14.4v0.16.5markdownlint-cli2v0.19.1v0.23.2mirrors-prettierv3.1.0v4.0.0-alpha.8shellcheck-pyv0.11.0.1v0.11.0.1-1pre-commit-shfmt,pre-commit-hooksThree things reviewers should see:
1. Both Node hooks are uninstallable on this machine — but were already, before the bump. prek's bundled Node 26.8.1 cannot run under macOS 12.7.6:
prek run markdownlint-cli2andprek run prettierboth fail withFailed to install hook … Command 'npm install' exited with an error … signal: 6 (SIGABRT)and that samedylderror. This was verified at the old revs too by temporarily restoring the pre-autoupdate config:v0.19.1andv3.1.0fail identically. So autoupdate did not cause this, and nothing was reverted or hidden behindSKIP=. It is a local-environment limitation only: the separateprekandpre-commitworkflow jobs (prek - macos-latest,prek - windows-latest,pre-commit - macos-latest,pre-commit - windows-latest) all pass on this branch's head, so the bumped Node hooks install and run correctly in CI.2.
mirrors-prettierwas bumped to a pre-release,v4.0.0-alpha.8. That is whatautoupdateselected; flagging it rather than silently pinning it back.3. The ruff hook and CI now run different ruff versions. The hook is
v0.16.5; CI runsuv run ruff, which resolves to the locked0.14.8. On this source they disagree:All five are auto-fixable, and with
fix = truethe hook will rewrite them rather than fail. Not fixed here; flagged for a decision on whether to bump the lockedruffto match the hook.fix = trueauto-write finding — still present, unchangedRe-confirmed after all four commits. Running the
lintjob command verbatim on a clean tree:[tool.ruff] fix = trueplusunsafe-fixes = true, combined with therequired-importsadded in58fdfab, means CI'sruff checkwrites to its checkout and still exits 0. The gate passes while the committed source is notrequired-imports-clean. Left as found, per instruction.Additional detail measured this pass: the file ruff's lint step writes is not what
ruff formatwants. After the lint job's rewrite,uv run ruff format --check packages/exits 1, asking for a blank line after the docstring. The two jobs run on independent checkouts so they do not collide in CI today, but any workflow that ran lint then format in one checkout would fail.One-line fix, if wanted: add
from __future__ import annotations(followed by a blank line) topackages/ensure_uv/__init__.py.Gate — baseline vs. this branch
Baseline is
origin/main(3301c47), fully green, as established in the first pass. Every command below was run verbatim this session.test.yml:42)uv run ruff format --check packages/3 files already formattedtest.yml:65)uv run ruff check --output-format=github packages/test.yml:89)uv run mypy packages/ --show-error-codes; nowuv run ty check packages/Success: no issues found in 3 source files)All checks passed!)test.yml:116)uv run ensure-uvtest.yml:119)uv run python -c "from ensure_uv import main; print('Import OK')"Import OKNo new gate errors, and no suppressions were added anywhere in this pass.
Caveats
--no-verify: the local prek hooks still cannot all install (Node, above), so CI remains the authoritative check.docs/TYPING_POLICY.md; this repo has no equivalent doc.Do not merge without review.