mne-python icon indicating copy to clipboard operation
mne-python copied to clipboard

Adding ArrayLike from numpy as a type hint leads to doc build errors.

Open 1himan opened this issue 7 months ago • 2 comments

Description of the problem

I'm trying to improve type hints in the /home/himan/projects/mne-python-issue13597/mne/preprocessing/ica.py file with something like this(one of the functions in that file):

  def get_explained_variance_ratio(
      self,
      inst: BaseRaw | BaseEpochs | Evoked,
      *,
      components: ArrayLike | int | None = None,
      ch_type: Literal["mag", "grad", "planar1", "planar2", "eeg"]
      | ArrayLike
      | None = None,
  ):

however the ArrayLike - sphinx is unable to resolve this ref properly. And give the following error:

 <unknown>:1: WARNING: py:class reference target not found:
  numpy._typing.ArrayLike [ref.class]

Link to data

No response

Expected results

Should build docs without the error described above and add proper ref to the ArrayLike.

Actual results

Throws an error and fails to resolve link.

Additional information

Discussion on this.

1himan avatar Apr 14 '26 09:04 1himan

Hi @1himan , Are you currently working on this issue? If not, I'd love to take it up. Please let me know, and I'll wait for your reply before proceeding. Thank you

Famous077 avatar Apr 19 '26 19:04 Famous077

there's no "takin up" on issues @Famous077. Can we first discuss, how do we plan to solve this? Any possible approaches and discussions.

And yes, I'm working on it right now, I'll push the discussed changes in #13671

1himan avatar Apr 20 '26 03:04 1himan