-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
Add type stub files to python's typeshed #12412
Comments
why? these ops already have been defined for quite some time this is a downstream issue |
They are monkey patched rather than defined explicitly (I think - tell me if I'm off), and so IDEs / static code checkers can't resolve them. Check out the xarray PR... |
as I said all of these are defined in line |
Help me understand where I'm mistaken here... I see them being defined here for ...and there's no |
these are all defined in ops I am unclear as to the problem py charm has used pandas for years |
Ok but pause for a moment on what I'm trying to get across, or ask if you need more info. Because the methods aren't defined in line, PyCharm can't evaluate that pandas objects have the methods. For example: So in xarray I added them in line, and PyCharm then can resolve them, even though they are never hit at run time. |
and is this new? this has never been reported before I would say this is a bug in py charm |
fixing a symptom is very rarely s good idea |
It is not new. I imagine that it hasn't been raised before because it's only very mildly annoying - although for a lot of people. Either that, or my setup is somehow different. Re the symptom - generally I couldn't agree more - in this case I can also empathize with a static code checker trying to resolve whether a method exists. And I think of this as more like an interface definition than a hack. FWIW I submitted an issue to PyCharm here: https://youtrack.jetbrains.com/issue/PY-18095 Another option would be to define skeletons here (I think this is how numpy does it), but I haven't gone into detail as to how that works. |
ok if they ever get back to you then either post here or open a new issue do you use PyCharm? no one I know ever used it / very heavyweight |
We use PyCharm for dev, Jupyter for exploration. I find PyCharm great actually - navigation, some code checking, refactoring. You're on vim / emacs? |
emacs |
@jreback I heard back from PyCharm https://youtrack.jetbrains.com/issue/PY-18095 They suggest putting together What are your views on this generally? Not sure it's the measured solution for the specific issue we were having, but a reasonable broader issue nonetheless. |
yes we should probably do this as it's the way to hint to the ch checkers. no idea how long / tricky this is |
OK @jreback, shall I start a new issue or do you want to reopen this and I'll rename it? |
What's the status of this? It's not clear this ticket is still open. The last comment on March 2 indicated that it was reopened, but... what does the "(!) Open" button mean? Are there some stubs laying about I can test, or should I just punt and run mypy's stubgen over my installed Pandas code? |
@smontanaro open means its open! nothing has been done on this, you are welcome to contribute fixes though! |
Thanks... Eh, I was thinking that was a button (given its color matching the obvious "Comment" button, and didn't hover my mouse to check that it wasn't. I can't push anything out of my work account, but will at least try and add some stubgen-generated .pyi files from home. I will also try to figure out why stubgen fails on some modules. Watch this space. |
I'm looking into this now.. Looks like you can generate stubs with the following script that's installed with mypy.. https://github.com/python/mypy/blob/master/mypy/stubgen.py |
See also data-science-types which has started work in that direction. |
Since we have #28142 going about the same issue. Going to close this issue in favor of that one. |
Same issue as xarray: pydata/xarray#771, resolved with pydata/xarray#773.
OK to do the same to
NDFrame
?The text was updated successfully, but these errors were encountered: