Description
What do people think about adding type hints to MNE? I know that this can be a controversial topic, and I myself have not been known to be a fan of type hints. However, if done right, I think they can be extremely valuable.
Since the codebase of MNE is large and does not have any type hints, it is not feasible to even try to type everything. This is only an option for new or smaller projects. However, we could start by adding type hints where they actually matter for users, and return values immediately come to mind.
For example, take the following code snippet:
import mne
raw = mne.io.read_raw("some_file.edf")
Currently, static type analyzers like Pylance in VS Code know nothing about the type of raw
, so when users want to call a method (or see a list of available methods), VS Code does not provide any completions whatsoever.
raw. # no completions at all
By adding -> mne.io.Raw
to the definition of mne.io.read_raw()
, we suddenly get the full list of methods:

Therefore, the reader functions would be a good place to start adding return types.