Repository navigation
FIX: correct v2 format argument type hints - #1206
Merged
FirefoxMetzger merged 2 commits intoSep 29, 2026
Merged
Conversation
Contributor
|
The CI failure are unrelated. Otherwise this looks good :) I forgot to merge the current master into this PR before running the CI. Triggered a re-run; assuming it comes back green I'll merge. |
Contributor
Author
|
Thanks for checking and rerunning CI! Everything looks green now. |
Contributor
|
hehe, could you reopen the PR @psgundla ? I had to go into my meetings before CI was all green so I didn't press merge yet and you closed the PR instead 😅 I'm happy to just create a new PR with your changes and tag you, but I think the contribution/history will be cleaner if we merge this one that you authored. |
Contributor
Author
|
Oops, my mistake 😅 I’ve reopened it. Thanks for catching that and for taking the time to review! |
Contributor
|
Merged! Thanks again @psgundla |
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.
Summary
Fixes #1194.
The V2 API accepts a format name/extension string or
None, but its stubs currently annotateformatasFormat. This makes valid calls such asimageio.v2.get_writer(path, format="PNG")fail static type checking.Union[str, None]forformatthroughout the V2 reader/writer signatures and overloads, consistent withdecypher_format_arg.Validation
python -m pytest tests/test_v2.py -m 'not needs_internet' -q: 9 passed, with the official test-image fixtures cached locally.black --check --target-version py312 imageio/v2.pyi: passed with Black 26.3.0.git diff --check: passed.None, and omitted formats, plus the four byte-output overloads: 36 errors before this change; zero after.Format,int, and arbitraryobjectvalues forformat.The mypy checks were run locally, not added as a new project-wide typing harness. Imported-module diagnostics were suppressed using
follow_imports = silent,follow_imports_for_stubs = True, andignore_missing_imports = Trueto isolate the client-facing regression from unrelated existing stub diagnostics.