Skip to content

fix(typing): Make sure mypy types ffi and lib as Any to avoid typing errors#6239

Open
klochek wants to merge 1 commit into
masterfrom
christopherklochek/fix_mypy_ffi_typing_errors
Open

fix(typing): Make sure mypy types ffi and lib as Any to avoid typing errors#6239
klochek wants to merge 1 commit into
masterfrom
christopherklochek/fix_mypy_ffi_typing_errors

Conversation

@klochek

@klochek klochek commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

I ran into bizarre typing errors while working on another PR, such as  py/sentry_relay/utils.py:13: error: "Lib" has no attribute "relay_init" [attr-defined]

I yolo'd Claude on this one, what it found seems plausible to me:

your pyproject.toml lists cffi_backend under ignore_missing_imports = true, so lib resolved to Any and every lib.relay* call was silently accepted. But a
_cffi_backend-stubs package is now installed in your venv (.venv/lib/python3.14/site-packages/_cffi_backend-stubs/, shipped by recent cffi). Once a stub is found, ignore_missing_imports
no longer applies — it only suppresses "module not found." That stub declares:

@Final
class Lib:
def dir(self): ...

So, looks like a recent devenv change surfaced this mypy issue. This PR appears to address it.

@klochek klochek requested a review from a team as a code owner July 15, 2026 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants