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 checking issues with matplotlib.pyplot #3273

Closed
Eureka-0 opened this issue Sep 2, 2022 · 4 comments
Closed

Type checking issues with matplotlib.pyplot #3273

Eureka-0 opened this issue Sep 2, 2022 · 4 comments
Assignees
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version typestub Issue relating to our bundled type stubs

Comments

@Eureka-0
Copy link

Eureka-0 commented Sep 2, 2022

Environment data

  • Language Server version: v2022.8.50
  • OS and version: Darwin arm64 22.1.0, macOS Ventura public beta
  • Python version (& distribution if applicable, e.g. Anaconda): python 3.10.6, conda 4.14.0

Code Snippet

import matplotlib.pyplot as plt

plt.style.use("default")

def myplot(ax: plt.Axes):
    ...

Repro Steps

With above code, it shows '"style" is not a known member of module' and '"Axes" is not a known member of module'.
iShot_2022-09-02_09 54 44
iShot_2022-09-02_10 17 34

It just works yesterday, so I installed pylance extension v2022.8.40, works fine.

@bschnurr
Copy link
Member

bschnurr commented Sep 2, 2022

thanks the issue.
We recently updated our matplot stubs from here https://github.com/Microsoft/python-type-stubs

I'll take a look

@bschnurr bschnurr added bug Something isn't working typestub Issue relating to our bundled type stubs labels Sep 2, 2022
@bschnurr bschnurr self-assigned this Sep 2, 2022
@bschnurr
Copy link
Member

bschnurr commented Sep 2, 2022

right click 'plt' and choose 'go to declaration'

add

from matplotlib import style as style

to vscode-pylance/dist/bundled/stubs/matplotlib/pyplot.pyi as a workaround for now

@bschnurr bschnurr added the fixed in next version (main) A fix has been implemented and will appear in an upcoming version label Sep 2, 2022
@Eureka-0
Copy link
Author

Eureka-0 commented Sep 3, 2022

right click 'plt' and choose 'go to declaration'

add

from matplotlib import style as style

to vscode-pylance/dist/bundled/stubs/matplotlib/pyplot.pyi as a workaround for now

That works, thank you!

I also changed from .axes import Axes to from .axes import Axes as Axes and fixed the issue about Axes.

@debonte
Copy link
Contributor

debonte commented Sep 8, 2022

This issue has been fixed in prerelease version 2022.9.11, which we've just released. You can find the changelog here: CHANGELOG.md

@debonte debonte closed this as completed Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed in next version (main) A fix has been implemented and will appear in an upcoming version typestub Issue relating to our bundled type stubs
Projects
None yet
Development

No branches or pull requests

3 participants