fix(python): clear ruff findings and pin the linter to a minor series - #123
Merged
Conversation
`ruff check python/` reported 31 errors on every open PR, including dependency bumps that touch no Python at all. The cause is not the code: the dev group declared `ruff>=0.4`, so CI resolved whatever ruff had most recently published — 0.16.4 today — and each release enables new default rules. The gate therefore changed under the repo with no commit, and all 11 open dependabot PRs went red together. Two parts: - Fix the findings. 29 were in the `_native.pyi` stub: drop the no-op `from __future__ import annotations` (stubs already have those semantics), give the three aliases an explicit `TypeAlias`, unquote the forward references, return `Self` from `__enter__`, and annotate `__exit__` with `types.TracebackType | None`. PEP 604/585 syntax is used only in the stub, where it is valid regardless of the 3.8 runtime floor. The remaining 2 were import and `__all__` ordering in `__init__.py`. - Pin `ruff>=0.16,<0.17` so a future release cannot turn every open PR red without a code change. `uv run ruff check python/` — the exact CI command — now passes, and mypy reports no issues on the stub. Claude-Session: https://claude.ai/code/session_01QCzrWMwEUtN6B3pN1HSKbb
Owner
Author
|
Correction to the "Effect" section above. Clearing ruff is necessary but not sufficient. The So this PR fixes the ruff half; #124 fixes the clippy half. Both are needed before the 11 dependabot PRs go green. Verified on |
yfedoseev
added a commit
that referenced
this pull request
Sep 1, 2026
* release: v0.1.9 — legacy .doc tables, lists, and tab stops Bumps the version across every binding (Rust crates, Python, JS, WASM, Go installer, C#) and adds the CHANGELOG entry for 0.1.9. Headline change is legacy binary .doc structure extraction into the IR — tables (#116) and lists + tab stops (#120), both contributed by @xugangqiang, closing #115. Also carries the IR list-nesting fix (#122), the clippy/ruff gate repairs (#123, #124), and a dependency refresh. Also refreshes stale version literals in the getting-started docs, which still advertised 0.1.6 (and 0.1.1 for the C# package). Claude-Session: https://claude.ai/code/session_011Ueq2ge9rTr3aCPsuTiFEs * chore(release): refresh bench_rust lockfile to 0.1.9 bench_rust is excluded from the workspace but carries a path dependency on office_oxide, so its lockfile pinned the stale 0.1.8. Not covered by .github/scripts/check-versions.sh, so it drifted silently across releases. Claude-Session: https://claude.ai/code/session_011Ueq2ge9rTr3aCPsuTiFEs * fix(changelog): date 0.1.9 as 2026-09-01 (UTC) The entry said 2026-08-31, taken from local time (PDT). Every prior release dates its heading in UTC — v0.1.8, v0.1.7 and v0.1.5 were all committed in the evening Pacific and dated the following UTC day. It is already 2026-09-01 in UTC, and the tag/GitHub Release will be stamped that way too. Claude-Session: https://claude.ai/code/session_011Ueq2ge9rTr3aCPsuTiFEs
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.
Why every dependabot PR is red
The
Lint and Format Checkjob (.github/workflows/python.yml:120) runsuv run ruff check python/and reports "Found 31 errors" — on every open PR, including bumps that touch no Python at all. It fails identically on a Rust-only bump (#117) and a CI-action-only bump (#101), which is what shows it isn't the bumps.The cause is the dependency declaration, not the code:
Unpinned, so CI resolves whatever ruff published most recently — 0.16.4 today — and each release turns on new default rules. The gate changed under the repo with no commit, and all 11 open dependabot PRs went red together. (Locally I had ruff 0.14.6 and
ruff check python/passed, which is exactly how this stayed invisible.)What's in here
1. Fix the 31 findings. 29 were in the
_native.pyistub:from __future__ import annotations— no effect in stubsFormatName/_Path/_CellValuean explicitTypeAlias__enter__returnsSelfPEP 604/585 syntax appears only in the stub, where it's valid regardless of the
requires-python = ">=3.8"runtime floor — stubs aren't evaluated at runtime. The remaining 2 findings were import and__all__ordering in__init__.py(auto-fixed).2. Pin
ruff>=0.16,<0.17so a future release can't silently redden every open PR again. Comment inpyproject.tomlsays why, so nobody widens it back.Verification
Also checked that every name in
__all__still resolves to an import from_nativeafter the reordering, and that both files parse. No runtime code changed beyond import/__all__order; the stub is never imported at runtime.Effect
This should unblock #101, #105, #106, #107, #108, #109, #112, #113, #114, #117 and #121 in one go. #105–#108 additionally carry stale August-12 runs that will want a re-run once this lands.
https://claude.ai/code/session_01QCzrWMwEUtN6B3pN1HSKbb