Skip to content

fix: repair the mypy CI step - #30

Merged
rkoopmans merged 1 commit into
masterfrom
fix/mypy-ci-command
Nov 2, 2026
Merged

rkoopmans merged 1 commit into
masterfrom
fix/mypy-ci-command

Conversation

@Sreini

@Sreini Sreini commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

The Mypy job is red 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 a single source file. setup.py lists mypy unpinned in tests_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:

tinify/client.py:34: error: Incompatible types in assignment (expression has type
"dict[str, str]", variable has type "CaseInsensitiveDict[str]")

requests types Session.headers as CaseInsensitiveDict, so this wraps the literal rather than assigning a plain dict. That is what requests builds 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.
  • Unit tests: 86 passed, 1 skipped.

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 tinify would not have caught the bug it fixes even when the command worked, because it checks the package rather than the call sites that consume ConvertTypes.

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.
@rkoopmans
rkoopmans merged commit 24ba780 into master Nov 2, 2026
69 checks passed
@rkoopmans
rkoopmans deleted the fix/mypy-ci-command branch November 2, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants