Skip to content

Conversation

eugeneliukindev
Copy link

This comment has been minimized.

@eugeneliukindev eugeneliukindev force-pushed the main branch 2 times, most recently from 81ea5b0 to 10c1e83 Compare September 10, 2025 13:53

This comment has been minimized.

@eugeneliukindev
Copy link
Author

If possible, please tell me how to correctly import library components without stubs.
The only way I used:

from eventlet.greenio import GreenSocket  # type: ignore # pyright: ignore # noqa: PGH003
from eventlet.wsgi import local  # type: ignore # pyright: ignore # noqa: PGH003

But I understand that it doesn't look nice.

@brianschubert
Copy link
Member

If possible, please tell me how to correctly import library components without stubs

Unfortunately you can't. You can can replace these with placeholder types (good choices are an @type_check_only Protocol or a named alias for Any) with a comment mentioning what type it represents.

This comment has been minimized.

@eugeneliukindev
Copy link
Author

@brianschubert Done!

Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/worker.py:38: error: Unused "type: ignore[misc, no-any-unimported]" comment  [unused-ignore]
+ aiohttp/worker.py:71:13: error: Statement is unreachable  [unreachable]
+ aiohttp/worker.py:71:13: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-unreachable for more info
+ aiohttp/worker.py:75:26: error: Too few arguments  [call-arg]
+ aiohttp/worker.py:75:26: note: See https://mypy.rtfd.io/en/stable/_refs.html#code-call-arg for more info
+ aiohttp/worker.py:75:26: note: "wsgi" is considered instance variable, to make it class variable use ClassVar[...]
+ aiohttp/worker.py:117: error: Unused "type: ignore" comment  [unused-ignore]

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