mne-tools / mne-python

MNE: Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python
https://mne.tools
BSD 3-Clause "New" or "Revised" License
2.71k stars 1.32k forks source link

Pylance doesn't know about datasets.sample.data_path() #12241

Closed hoechenberger closed 11 months ago

hoechenberger commented 11 months ago

Description of the problem

Pylance claims that mne.datasets.sample.data_path() is an unknown entity: signal-2023-11-25-144641_002

Steps to reproduce

import mne
mne.datasets.sample.data_path()

Link to data

No response

Expected results

Editor would offer auto-completion and docstrings

Actual results

Editor doesn't know about data_path()

Additional information

This is on main. Problem has existed already before we moved to lazy loading. I tried getting to the bottom of this but I really don't understand what's going on here. No problems at runtime. Applies to all datasets, not only sample.

hoechenberger commented 11 months ago

I'm seeing something similar for mne.io.read_raw_fif(), but not for mne.io.read_raw():

Screenshot 2023-11-25 at 15 48 52
hoechenberger commented 11 months ago

Can only be reproduced if working in a VS Code workspace that doesn't have the mne-python folder open. E.g., do

code --new-window /tmp/mwe.py
cbrnr commented 11 months ago

As we've just discussed, this works for me... even in a different workspace.

hoechenberger commented 11 months ago

It seems the problem was in fact related to some type stubs floating around somewhere, so most probably not a bug in MNE or VS Code per se!