microsoft / python-type-stubs

A set of type stubs for popular Python packages. These are works in progress from the Microsoft Python team and others, with the intent that they are contributed to typeshed or to the associated packages once sufficiently complete.
MIT License
252 stars 99 forks source link

Add type stubs for sympy #307

Closed rchiodo closed 8 months ago

rchiodo commented 8 months ago

In Pylance we've had numerous performance issues with Sympy. These stubs eliminate all of the overhead with analyzing sympy.

The stubs were generated from the 1.12 release of Sympy. If Sympy were to ship, there's another set of these stubs that are closer to the Sympy 1.13dev branch.

rchiodo commented 8 months ago

After this PR is submitted, I'll modify the Pylance build to pull them into our bundled stubs.

debonte commented 8 months ago

After this PR is submitted, I'll modify the Pylance build to pull them into our bundled stubs.

We should automatically pull these over via the "Copy python-type-stubs stubs to pylance" step in update_other_stubs.yml

rchiodo commented 8 months ago

Tested by installing into the 'typings' folder of a workspace and then tried using sympy.

Without these stubs I get this:

2024-03-19 14:20:36.867 [info] [Info  - 2:20:36 PM] (9044) [BG(1)] Long operation: analyzing: file:///c%3A/Users/rchiodo/source/testing/Testing_Pyright_2/test_sympy.py (15891ms)
debonte commented 8 months ago

I think you mentioned at one point that when Pyright generates stubs, the types are initially commented out? Did you write a script to uncomment them? Should we document how to generate/update these stubs?

rchiodo commented 8 months ago

I think you mentioned at one point that when Pright generates stubs, the types are initially commented out? Yes that's true. It leaves them commented out.

Did you write a script to uncomment them? I did. I also wrote a script to remove doc strings.

Should we document how to generate/update these stubs? At this point they need to be updated by hand I think.

I'll add a readme.md to the sympy stubs directory.