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

include pandas, matplotlib and other bundled stubs #659

Closed
tekumara opened this issue Jul 20, 2020 · 8 comments
Closed

include pandas, matplotlib and other bundled stubs #659

tekumara opened this issue Jul 20, 2020 · 8 comments

Comments

@tekumara
Copy link

Pylance bundles stubs for:

  • django
  • jmespath
  • matplotlib
  • pandas
  • PIL
  • onnxruntime

Pyright doesn't.

Would be nice to have a consistent user experience when using Pylance in VSCode and Pyright on the CLI and in CI/CD.

If this isn't possible, would it be possible to provide these stubs (in particular pandas and matplotlib) as a separately installable pypi distribution?

@erictraut
Copy link
Contributor

Thanks for the suggestion. There are some licensing questions/details to work out, but I agree with the goal that you've stated above, and we're working to address that goal. It will probably not involve a separately installable pypi distribution, however.

@m3at
Copy link

m3at commented Aug 6, 2020

@tekumara in the meanwhile you can find stubs for numpy/pandas/matplotlib here (install with pip install data-science-types).

@fabiencelier
Copy link

+1 for pandas and numpy
What's the recommended way to use data-science-types in my project with pyright ?
Should I clone the relevant library stubs into the typings folder of my project or use it as a Python dependency ?

@erictraut
Copy link
Contributor

For libraries that include stubs, install them as you would normally. In some cases, you will need to update to the latest package version. Numpy, for example, has only recently added in-package stubs.

For libraries that publish company "stub packages" (whose names end in "-stubs"), install those into your Python environment.

For other libraries that do not yet publish their own stubs, if you can find stubs (or want to create minimal versions of stubs yourself), you can place these in your local stubs folder. Depending on your project, you may want to check these in to your repo so other members of your team have access to them as well.

@erictraut
Copy link
Contributor

A quick update on this request. The stub files that ship with Pylance are very incomplete. They're sufficient for basic type completions, but they are not complete enough for strict type checking or for submission to typeshed. Additional work needs to be done on them first. Once each stub is far enough along, it will be submitted to typeshed and get incorporated into pyright.

@blumu
Copy link

blumu commented Aug 25, 2020

@m3at Unfortunately the data-science-types bundle multiple packages together, and in particular it overrides the numpy typings now provided by the official numpy package.

@m3at
Copy link

m3at commented Aug 26, 2020

@blumu yes it's not ideal, having the official packages provide their own types would be best. Though you can easily use the pandas and matplotlib stubs only: fork the repo, remove this line and pip install git+https://github.com/blumu/data-science-types

@erictraut erictraut transferred this issue from microsoft/pyright Nov 30, 2020
@jakebailey
Copy link
Member

jakebailey commented Nov 30, 2020

I'm going to mark this as a duplicate of #277. We already intend to publish the stubs somewhere (in the works but it takes a lot to publish a repo), though I'm not so sure about a PyPI package immediately.

onnxruntime is not a Python module; we don't ship stubs for that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants