Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Type hints are not retained #1487

Open
2 tasks done
phmarch opened this issue Feb 7, 2024 · 4 comments
Open
2 tasks done

Type hints are not retained #1487

phmarch opened this issue Feb 7, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@phmarch
Copy link

phmarch commented Feb 7, 2024

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

  • I have checked that this issue has not already been reported.
  • 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 phmarch added the bug Something isn't working label Feb 7, 2024
@schatimo
Copy link
Contributor

schatimo commented Feb 7, 2024

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

@phmarch
Copy link
Author

phmarch commented Feb 7, 2024

@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?

@schatimo
Copy link
Contributor

schatimo commented Feb 7, 2024

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.

@phmarch
Copy link
Author

phmarch commented Feb 7, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants