Make build.sh stubtest run again - #1492
Merged
Merged
Conversation
disallow_any_explicit applied to every module the stub pulls in, not just the stub under test. Once pygit2/_libgit2/ffi.pyi arrived in 58d1271, that aborted the run with 25 errors in files stubtest never reads. Nothing in CI runs this command, so it went unnoticed. The setting is now scoped: off for the package, on for pygit2._pygit2. stubtest reports no issues with the stub as it stands. Assisted-by: Claude Opus 5 (Claude Code)
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.
build.sh stubtestdoes not run. It aborts before checking anything:disallow_any_explicit = Trueis set globally inmypy-stubtest.ini, so it applies to every module the build pulls in, not only to the stub under test. That was harmless untilpygit2/_libgit2/ffi.pyilanded in58d12711(2025-07-26): the cffi binding stub isAny-typed by nature, and it is imported from_pygit2.pyi. Nothing in CI runsbuild.sh stubtest-lint.ymlrunsbuild.sh mypyandtests.ymlrunsbuild.sh test- so it has been dead since then.Scoping the setting fixes it, and the stub turns out to be clean:
The check still bites where it is meant to. Appending
broken_probe: Anyto_pygit2.pyigivespygit2/_pygit2.pyi:890: error: Explicit "Any" is not allowed [explicit-any], which is how I confirmed the narrower scope is not just silencing the rule._pygit2.pyiuses no explicitAnytoday, so nothing in it is newly permitted.Two things I did not do.
follow_imports = skipforpygit2.*also silences the errors, but it makes theLiteral[...]parameters in the stub resolve toAnyand mypy then rejects nine of them, so it is the wrong lever. And I did not addstubtestto CI: it needs the extension built and that is a workflow decision rather than a config fix - happy to send it if you want it.mypy 2.3.1 (
requirements-typing.txtpins no version, so this is what a contributor gets today).Assisted-by: Claude Opus 5 (Claude Code), per CONTRIBUTING.md; the commit carries the trailer.