pylint icon indicating copy to clipboard operation
pylint copied to clipboard

Using typeshed stubs instead of dependencies

Open xrmx opened this issue 2 months ago • 1 comments

Question

Would it be possible (or even make sense) to use to use the stubs from typeshed instead of the real libraries in pylint checks?

import requests

requests.get("https:")

returns

foo.py:3:0: W3101: Missing timeout argument for method 'requests.get' can cause your program to hang indefinitely (missing-timeout)

with requests installed but nothing with just types-requests.

Documentation for future user

No idea, it would be nice to have an example in the tutorial using a third party library and explicitly saying you need to install it in order to provide more checks.

Additional context

No response

xrmx avatar Apr 29 '24 10:04 xrmx

Thank you for the suggestion. I added the need design proposal because I don't know if we should always use the stub if it exists or leave the choice to the user, or how to remove the lib files from the analysis if the stub exists. It feels non trivial :)

Pierre-Sassoulas avatar Apr 30 '24 21:04 Pierre-Sassoulas