hgrecco / pint

Operate and manipulate physical quantities in Python
http://pint.readthedocs.org/
Other
2.33k stars 459 forks source link

How to get type hinting to work? #1958

Open npetersen2 opened 3 months ago

npetersen2 commented 3 months ago

Simple question. I love pint and use it for many things, but I have never gotten even very simple type hinting to work in VS Code.

image

Why, when I create a pint Quantity object, VS Code thinks it is an Any type? This seems wrong... I just want VS Code to know it is a Quantity, so it can auto-complete methods nicely. I have read other issues in the GitHub repo here about type hinting for specific kinds of units, which of course would be nice, but I think this is much simpler.

Another example in a function:

image

layathepup commented 2 months ago

I have the same issue with intellij