Skip to content

Type public Epochs, Evoked, and io members fully#14056

Open
larsoner wants to merge 3 commits into
mne-tools:mainfrom
larsoner:typed-fully
Open

Type public Epochs, Evoked, and io members fully#14056
larsoner wants to merge 3 commits into
mne-tools:mainfrom
larsoner:typed-fully

Conversation

@larsoner

Copy link
Copy Markdown
Member

Okay this PR diff is big, but it's simple enough at its core:

  1. Add a test that checks that our NumpyDoc-documented docstrings match the types we define in our code. This turned up a few minor issues (fixed).
  2. Fill in type annotations for public interfaces in mne/io, mne/evoked.py, and mne/epochs.py, ensuring the test passes

I had Claude Opus 4.8 work on the test, but I simplified it and checked it. I also had Claude do the drudge-work of putting all those type annotations inline. The test ensures they're correct, though, so this should make review a bit easier (hopefully)!

This adds a little bit of work to future contributions having to type-define two places (docstring + code), but I don't think that's too onerous. Someday if numpy/numpydoc#196 (or numpy/numpydoc#601) lands we could maybe DRY things again.

I think with this scaffolding in place, we're safe to move to typing other modules in a similar fashion (or by using typestubs as a first pass, which @drammock is going to look into IIRC). In the meantime, I suggest we add this since it should make things slightly nicer for our end-users.

I considered pydoclint as a checker, but it is a static tool, so we need to get rid of %/docdict before we could pursue that.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant