Repository navigation
fix: repair the mypy CI step - #30
Merged
Merged
Conversation
The Mypy job has been failing on every branch: mypy: error: ambiguous option: --check could match --check-untyped-defs, --check-unreachable --check was never a real flag. It used to resolve as an unambiguous abbreviation, but a newer mypy added --check-unreachable, so it no longer does and mypy exits 2 during argument parsing, before reading any source. setup.py lists mypy unpinned, so CI installs whatever is current. Dropping the flag exposed a second, pre-existing error that had been masked for as long as the step was broken: tinify/client.py:34: Incompatible types in assignment (expression has type "dict[str, str]", variable has type "CaseInsensitiveDict[str]") requests types Session.headers as CaseInsensitiveDict, so wrap the literal rather than assigning a plain dict. This is what requests builds the attribute with by default, so runtime behaviour is unchanged and header lookups become case-insensitive as the library intends. mypy tinify now reports no issues across all 8 source files.
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.
The Mypy job is red on every branch:
--checkwas never a real flag. It used to resolve as an unambiguous abbreviation, but a newer mypy added--check-unreachable, so it no longer does and mypy exits 2 during argument parsing — before reading a single source file.setup.pylistsmypyunpinned intests_require, so CI installs whatever is current and this went red without any commit landing.Dropping the flag exposed a second error that had been masked for as long as the step was broken:
requeststypesSession.headersasCaseInsensitiveDict, so this wraps the literal rather than assigning a plain dict. That is whatrequestsbuilds the attribute with by default, so runtime behaviour is unchanged and header lookups become case-insensitive as the library intends.Verification
mypy tinify→ Success: no issues found in 8 source files.Confirmed pre-existing by pushing a throwaway branch at
master's exact tip with zero changes (since deleted): all three Mypy jobs failed identically.This unblocks #28. Worth noting for that PR:
mypy --check tinifywould not have caught the bug it fixes even when the command worked, because it checks the package rather than the call sites that consumeConvertTypes.