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

Provides IntelliSense better for Python 3.12 #5053

Closed
ydmykr opened this issue Oct 30, 2023 · 5 comments
Closed

Provides IntelliSense better for Python 3.12 #5053

ydmykr opened this issue Oct 30, 2023 · 5 comments
Assignees

Comments

@ydmykr
Copy link

ydmykr commented Oct 30, 2023

This is an issue related on StackOverflow.

import matplotlib.pyplot as plt

fig, ax = plt.subplots()

fruits = ['apple', 'blueberry', 'cherry', 'orange']
counts = [40, 100, 30, 55]
colours = ['red', 'blue', 'red', 'orange']

ax.bar(fruits, counts, label=colours, color=colours)

ax.set_ylabel('fruit supply')
ax.set_title('Fruit supply by kind and color')
ax.legend(title='Fruit color')

plt.show()

For the same code, if I use python 3.11, type the dot after ax and I get the intellisense, but switching to 3.12 doesn't.

@lcdunne
Copy link

lcdunne commented Oct 30, 2023

Not sure if my issue is related but I recently downloaded VSCode and I am having intellisense problems too, only I'm using Python 3.11.2. I have the Python extension, but disabling Pylance makes the intellisense work better (so I guess Jedi is ok but Pylance is not?). I wonder if this issue relates to Pylance?

@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Oct 30, 2023
@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Oct 30, 2023
@tomvothecoder
Copy link

Not sure if my issue is related but I recently downloaded VSCode and I am having intellisense problems too, only I'm using Python 3.11.2. I have the Python extension, but disabling Pylance makes the intellisense work better (so I guess Jedi is ok but Pylance is not?). I wonder if this issue relates to Pylance?

I also just started having Intellisense problems today after it was working fine last week. I think this has to do with a bug in Pylance v2023.10.40 and v2023.10.50 (#5055 and #5019), which we both released recently.

I downgraded to Pylance v2023.10.30 and Intellisense is working again.

@debonte
Copy link
Contributor

debonte commented Oct 31, 2023

I don't see Intellisense after ax. in either version of Python. The reason is that plt.subplots in matplotlib 3.8.0 returns tuple[Figure, Any], so Pylance doesn't know the type of ax. Matplotlib 3.8.0 added inline types which Pylance trusts because the lib is py.typed.

Maybe the original poster on StackOverflow was using different matplotlib versions in addition to different Python versions? If I install matplotlib 3.7.3 instead of 3.8.0, then Pylance uses its bundled matplotlib stubs and treats ax as an Axes object.

@debonte debonte added external bug and removed needs repro Issue has not been reproduced yet labels Oct 31, 2023
@debonte debonte closed this as completed Oct 31, 2023
@dlefcoe
Copy link

dlefcoe commented May 12, 2024

I am the original posted and confirm that i am using version 3.8.0
I did not try earlier versions and would be averse to roling back versions.

@debonte
Copy link
Contributor

debonte commented May 13, 2024

I am the original posted and confirm that i am using version 3.8.0
I did not try earlier versions and would be averse to roling back versions.

Ok. Please file an issue on matplotlib at https://github.com/matplotlib/matplotlib/issues. Pylance is behaving correctly here given the current tuple[Figure, Any] return type annotation in matplotlib 3.8.0.

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

No branches or pull requests

6 participants