Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

No type hints detected by mypy: module is installed, but missing library stubs or py.typed marker #4806

Closed
bew opened this issue Feb 12, 2025 · 3 comments · Fixed by #4826
Closed

Comments

@bew
Copy link

bew commented Feb 12, 2025

Here are the exact steps I did:

# In an empty folder:
$ poetry init
$ poetry add reflex # Installed version 0.7.0
$ poetry add --dev mypy # Installed version 1.15.0
$ reflex init # Using the blank template
$ reflex run # it works fine, I stopped it

$ mypy .
rxconfig.py:1: error: Skipping analyzing "reflex": module is installed, but missing library stubs or py.typed marker  [import-untyped]
try_reflex_app/try_reflex_app.py:3: error: Skipping analyzing "reflex": module is installed, but missing library stubs or py.typed marker  [import-untyped]
try_reflex_app/try_reflex_app.py:3: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
Found 2 errors in 2 files (checked 3 source files)

But issues like #3374 make me think that mypy was working already for them, so maybe I'm just missing something?

What's most surprising is that the installed reflex package does have the .pyi files 🤔

edit: After thinking about it, I definitely should have used the bug issue template, sorry about that.. I can re-create it if you need

@adhami3310
Copy link
Member

we haven't tested mypy deeply, but generally speaking, we only support pyright, other type checkers may have incomplete or wrong types, i might investigate this later

@Lendemor Lendemor added bug Something isn't working needs investigation and removed bug Something isn't working labels Feb 12, 2025
@bew
Copy link
Author

bew commented Feb 14, 2025

Hello, adding an empty file py.typed at the root of the package could help a lot already.

This file is a standard:
https://typing.readthedocs.io/en/latest/spec/distributing.html#packaging-type-information

Package maintainers who wish to support type checking of their code MUST add a marker file named py.typed to their package supporting typing. This marker applies recursively: if a top-level package includes it, all its sub-packages MUST support type checking as well.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants