Replies: 2 comments 7 replies
-
|
I stumbled upon another weird Reflex pattern mypy complains about: I have code similar to this snippet from the docs for handling uploaded files: class State(rx.State):
"""The app state."""
async def handle_upload(
self, files: list[rx.UploadFile]
):
...
def index():
return rx.vstack(
rx.upload(
...,
on_drop=State.handle_upload(
rx.upload_files(upload_id="upload2")
),
),
...,
)mypy errors are
Both of these errors make complete sense to me. At this point, I'm wondering how/why this is actually working at runtime. I guess some black magic in the Reflex internals? |
Beta Was this translation helpful? Give feedback.
-
|
we don't particularly support mypy out of sanity, we have a gigantic API that is pretty hard to make it type check correctly for mypy and pyright, some stuff are just limitations/bugs of mypy, we welcome PRs though |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm working on a project with Reflex. In the past, we had not much problems using mypy but since upgrading Reflex from 0.6.4 to the latest release (now 0.7.5), mypy suddenly has lots of complains.
Many of these issues seem to be coming from within Reflex. For example, the automagically created setters for state variables seem to be unknown to mypy. Further, I got complains like "Module not callable" on
rx.icon()or '"Var[Any]" has no attribute "button"' onrx.color_mode.button().Now I'm wondering: Are others using mypy on Reflex projects without problems (i.e. those are issues I could actually fix in my code) or is this an inherent problem with Reflex and should I just give up on using mypy in this project?
Beta Was this translation helpful? Give feedback.
All reactions