pandera icon indicating copy to clipboard operation
pandera copied to clipboard

Type hints are not retained

Open phmarch opened this issue 1 year ago • 4 comments

Describe the bug Basic use case of static model class does not retain its type checking after enforcement

  • [x] I have checked that this issue has not already been reported.
  • [x] I have confirmed this bug exists on the latest version of pandera.

Expected behavior

Typing should be retained Columns can be auto-completed

Desktop:

  • VSCode
  • Pylance

Screenshots

image

phmarch avatar Feb 07 '24 00:02 phmarch

I cannot replicate this (with pandera 0.18.0 and pandas 2.2.0), so I guess it is not related to pandera but to your environment and VS Code setup. image

schatimo avatar Feb 07 '24 09:02 schatimo

@schatimo That's somehow reassuring. What language server are you using, I'm on pylance but I've read mypy is better integrated?

Also, I'm not getting column suggestions: image

And the infered type is unknown: image

Is it behaving like this in your setup?

I'm on the same librairy version too, so it's definitely a VSCode setup thing: pandas==2.2.0 pandera==0.18.0

Do you have additionnal editor settings?

phmarch avatar Feb 07 '24 15:02 phmarch

I use Pylance, yes, but mypy for static type checking (as I do not use pyright which comes with Pylance but is disabled by default if I recall correctly). I have a couple of settings in VS Code. So, I would close the issue as it is unrelated to pandera and not a bug but related to your settings.

schatimo avatar Feb 07 '24 17:02 schatimo

Go ahead, but I'd love to get some more directions on how to enable those type hints properly

phmarch avatar Feb 07 '24 17:02 phmarch