Skip to content

Conversation

@hoechenberger
Copy link
Member

@hoechenberger hoechenberger commented Oct 20, 2025

That way, the built distributions won't expose these optional dependencies anymore.

This is supported in pip since version 25.2 (released end of July).

FYI I originally placed the dependency-groups section in pyproject.toml below the extras, but one of our pre-commit hooks moved it up, right below the build system specs.

hoechenberger and others added 4 commits October 20, 2025 20:14
That way, the built distributions won't expose these optional dependencies anymore. This is supported in `pip` since version 25.2 (released end of July).
@drammock
Copy link
Member

I realize this is a draft PR, so you may already know / be planning this, but FWIW you'll at least need to touch tools/circleci_dependencies.sh as we do there something like pip install -e .[test,doc,dev] or so

@hoechenberger
Copy link
Member Author

you'll at least need to touch tools/circleci_dependencies.sh as we do there something like pip install -e .[test,doc,dev] or so

pip seems to treat extras and dependency groups the same when invoked like this, so there's no need to change those commands for now :) At least that's my understanding. Let's see how the tests come back

@hoechenberger
Copy link
Member Author

I realize this is a draft PR

No worries, all feedback is welcome ;)

@drammock
Copy link
Member

pip seems to treat extras and dependency groups the same when invoked like this, so there's no need to change those commands for now :) At least that's my understanding. Let's see how the tests come back

I though it was pip install --group dev -e . or so 🤔

(also if such changes are needed, then tools/azure_dependencies.sh will probably also need attention)

@drammock
Copy link
Member

regardless, thanks for working on this! I've been wishing someone had the time to work on it

@hoechenberger
Copy link
Member Author

hoechenberger commented Oct 20, 2025

I though it was pip install --group dev -e . or so 🤔

Me too, then I tested it, it seemed to work without --group; now I checked again and it seems I tested with a contaminated venv. It does, in fact, not work – just as you correctly assumed.

I'm wondering if it even makes sense to continue here, or if I should rather start working on switching over to uv right away instead. I've been using uv exclusively for all my projects for more than a year now (and also completely ditched conda).

Not sure what the best way forward is now. Any input is welcome!

@drammock
Copy link
Member

I'm wondering if it even makes sense to continue here, or if I should rather start working on switching over to uv right away instead.

uv also supports --group (as well as --all-groups and other variations) so it should be straightforward to do this PR first, and then switch to uv in a subsequent PR. In other words, I don't think doing it all in 1 PR saves much effort. (I'd also like to save the conversion-to-uv as a training exercise for the new maintainers we're currently onboarding, so selfishly I'd prefer if this PR only did the dep groups part)

@hoechenberger hoechenberger marked this pull request as ready for review October 20, 2025 21:41
@hoechenberger
Copy link
Member Author

CI errors are unrelated (NumPy API change, it seems)

This one is ready for review.

Copy link
Member

@larsoner larsoner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1 for merge!

@drammock
Copy link
Member

CI errors are unrelated (NumPy API change, it seems)

np.ndarray.ptp -> Use np.ptp(arr, ...) instead.

https://numpy.org/devdocs/numpy_2_0_migration_guide.html#ndarray-and-scalar-methods

@larsoner
Copy link
Member

Worked around in recent PR, I'll fix the conflict but it should come back green

@drammock
Copy link
Member

Copy link
Member

@drammock drammock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great that this is working! Aside from a couple inline remarks below, 2 high-level comments:

  1. I think we now need to pin to pip >= 25.1 as a dev dependency, right? (25.1 is when the --group flag was added)
  2. Should we do some communication with downstream projects re: this change? If for some reason they were using one of our developer-focused extras in their CIs, and e.g. pip install mne[test] is going to start failing for them at the next release, it seems a bit mean to just spring it on them with no warning. Ideally we would have committed to doing this a while ago and announced it in the prior release's changelog, and then done it now. But since we didn't do that, I think we should at minimum announce this in the upcoming changelog (and tell them what the fix is) so that if they do need to change their CI config it will be as painless as possible.
pyproject.toml Outdated
requires = ["hatch-vcs", "hatchling"]

[dependency-groups]
dev = ["rcssmin", {include-group = "doc"}, {include-group = "test"}]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do people think about making dev group depend on test_extra instead of just test? That way, dev will include everything needed to run all tests (without test_extra some tests will get skipped)

Suggested change
dev = ["rcssmin", {include-group = "doc"}, {include-group = "test"}]
dev = ["rcssmin", {include-group = "doc"}, {include-group = "test_extra"}]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disk space is cheap and plenty, so why not :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@larsoner can you make this change too while you're at it? (or just push the "commit suggestion" button)

sleepecg tensorpac yasa meegkit eeg_positions wfdb \
curryreader
curryreader \
--group=test --group=doc
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's legal to put these flags at the end of the command, but it seems to me a bit nicer to put them adjacent to -ve .[full] (since . is the package they apply to). IDK if it works to do pip install . --group=test package2 package3 (sticking the group flag in between other deps), but if it doesn't maybe we could just move -ve .[full] to the end (after curryreader)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm open to anything if you believe it improves readability!

Since we're talking about this particular section of the script: I'm not a fan of having dependencies listed inline like this … any chance we could change that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you suggesting adding another dependency group for these? It seems a bit odd to add a dep group just for ease of CI usage (not sure end users will ever want this set of deps as a whole?) @larsoner WDYT about adding these to a dep group?

They look like the "related community projects" from https://mne.tools/dev/install/mne_tools_suite.html#related-software but it seems some are missing (antio, best-python, cross-domain-saliency-maps, ...) Maybe it's the set of community projects that are in the installer?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has more to do with our doc build than anything else (most are just used for the "related software" section) and it's the only place they're used, so circleci_dependencies.sh makes more sense as a place to have them to me than the more general pyproject.toml

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was more thinking along the lines of a requirements.txt

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A doc/related_software.txt could make sense and be nicely scoped / named for its purpose etc., and reduce this to just -r doc/related_software.txt. Feel free to push here if @drammock agrees!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has more to do with our doc build than anything else (most are just used for the "related software" section) and it's the only place they're used, so circleci_dependencies.sh makes more sense as a place to have them to me than the more general pyproject.toml

Thinking about it, why shouldn't we have dep groups of the kind build-docs or docs-ci? That way, all dependencies for everything we do would be centralized 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both approaches "centralize" different ways... depends on whether you want to centralize/prioritize "as many dependency specs as possible should live in pyproject.toml" vs "as much doc-build-related stuff as possible should live in doc/". To me pyproject.toml is most useful/ideal when lists are intended to get reused multiple places, rather than as a host for all possible dependency specs for a project. This particular list is really a one-off related to doc/sphinxext/related_software.py. The most natrual place actually would be for it to live in that .py script if we could pull it off -- there are some relationships between that file and this list -- but then at least doc/ is closer than pyproject.toml from a filesystem/scope sense.

For another example, if we wanted to move as many deps as possible to pyproject.toml, we'd want to add an entry for PyQt5 for our Qt tests in azure-pipelines.yml, and I think that would (also) make it a bit harder to maintain rather than keeping that specific dependency (which is only ever used there, like in the CircleCI case) in azure-pipelines.yml. There are probably other cases like this, too, for other CI-related things in our GHA and/or Azure runs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll push a quick commit to add the requirements file and fix the conflict then mark for merge-when-green, since this otherwise seems almost good to go

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks Eric, please feel free to take over and push this over the finish line, I likely won't have time for a bit!

@larsoner
Copy link
Member

Should we do some communication with downstream projects re: this change? If for some reason they were using one of our developer-focused extras in their CIs, and e.g. pip install mne[test] is going to start failing for them at the next release, it seems a bit mean to just spring it on them with no warning.

Thinking about this a bit, I am pretty sure mne-* projects just install MNE, then do their own test-related deps. And if they don't, it should be a quick enough fix and mostly dev-facing. So I think an entry in doc/changes/13452.other.rst should be good enough to warn/tell people. I'll add that and you can see if you agree @drammock !

@larsoner
Copy link
Member

Okay @drammock should be good to go!

@drammock drammock enabled auto-merge (squash) October 24, 2025 19:56
@drammock drammock merged commit 4fb5442 into mne-tools:main Oct 24, 2025
32 checks passed
@cbrnr
Copy link
Contributor

cbrnr commented Oct 27, 2025

Nice, thanks @hoechenberger, @larsoner, and @drammock!

larsoner added a commit to larsoner/mne-python that referenced this pull request Oct 27, 2025
* upstream/main: (23 commits) ENH: Add on_missing for combine_channels (mne-tools#13463) Bump the actions group with 2 updates (mne-tools#13464) Move development dependencies into a dependency group (no more extra) (mne-tools#13452) ENH: add on_missing for rename_channels (mne-tools#13456) add advisory board to website (mne-tools#13462) ENH: Support Nihon Kohden EEG-1200A V01.00 (mne-tools#13448) MAINT: Update dependency specifiers (mne-tools#13459) ENH: Add encoding parameter to Nihon Kohden reader (mne-tools#13458) [MAINT] Automatic SPEC0 dependency version management (mne-tools#13451) FIX: Read Nihon Kohden annotation file accurately (mne-tools#13251) MAINT: Restore edfio git install (mne-tools#13421) Support preload=False for the new EEGLAB single .set format (mne-tools#13096) [pre-commit.ci] pre-commit autoupdate (mne-tools#13453) MAINT: Restore PySide6 6.10.0 testing (mne-tools#13446) MAINT: Auth [skip azp] [skip actions] MAINT: Deploy [circle deploy] [skip azp] [skip actions] Bump github/codeql-action from 3 to 4 in the actions group (mne-tools#13442) ENH: Dont constrain fiducial clicks to mesh vertices (mne-tools#13445) Use timezone-aware ISO 8601 for website timestamp (mne-tools#13347) [pre-commit.ci] pre-commit autoupdate (mne-tools#13443) ...
larsoner added a commit to BeiGeJin/mne-python that referenced this pull request Nov 5, 2025
* upstream/main: (230 commits) FIX: Fix ICA.apply when fitted including marked bad channels (mne-tools#13478) FIX: Correctly set the calibration factor in Nihon Kohden reader (mne-tools#13468) [pre-commit.ci] pre-commit autoupdate (mne-tools#13479) MAINT: Update code credit (mne-tools#13477) Fix `versionadded` directive formatting (mne-tools#13471) typo in mailmap (mne-tools#13475) FIX: Fix _plot_topomap channel names plotting when using a mask (mne-tools#13470) FIX: Handle an Eyelink File with blank lines injected throughout file (mne-tools#13469) ENH: adds annotation filtering to raw and ica source figures (mne-tools#13460) MAINT: Restore VTK nightly wheel on Linux and bump changelog checker (mne-tools#13436) [pre-commit.ci] pre-commit autoupdate (mne-tools#13465) FIX: Fix add_reference_channels for passing two channels names (mne-tools#13466) ENH: Add on_missing for combine_channels (mne-tools#13463) Bump the actions group with 2 updates (mne-tools#13464) Move development dependencies into a dependency group (no more extra) (mne-tools#13452) ENH: add on_missing for rename_channels (mne-tools#13456) add advisory board to website (mne-tools#13462) ENH: Support Nihon Kohden EEG-1200A V01.00 (mne-tools#13448) MAINT: Update dependency specifiers (mne-tools#13459) ENH: Add encoding parameter to Nihon Kohden reader (mne-tools#13458) ...
larsoner added a commit to szz-dvl/mne-python that referenced this pull request Nov 5, 2025
* upstream/main: (85 commits) FIX: Fix ICA.apply when fitted including marked bad channels (mne-tools#13478) FIX: Correctly set the calibration factor in Nihon Kohden reader (mne-tools#13468) [pre-commit.ci] pre-commit autoupdate (mne-tools#13479) MAINT: Update code credit (mne-tools#13477) Fix `versionadded` directive formatting (mne-tools#13471) typo in mailmap (mne-tools#13475) FIX: Fix _plot_topomap channel names plotting when using a mask (mne-tools#13470) FIX: Handle an Eyelink File with blank lines injected throughout file (mne-tools#13469) ENH: adds annotation filtering to raw and ica source figures (mne-tools#13460) MAINT: Restore VTK nightly wheel on Linux and bump changelog checker (mne-tools#13436) [pre-commit.ci] pre-commit autoupdate (mne-tools#13465) FIX: Fix add_reference_channels for passing two channels names (mne-tools#13466) ENH: Add on_missing for combine_channels (mne-tools#13463) Bump the actions group with 2 updates (mne-tools#13464) Move development dependencies into a dependency group (no more extra) (mne-tools#13452) ENH: add on_missing for rename_channels (mne-tools#13456) add advisory board to website (mne-tools#13462) ENH: Support Nihon Kohden EEG-1200A V01.00 (mne-tools#13448) MAINT: Update dependency specifiers (mne-tools#13459) ENH: Add encoding parameter to Nihon Kohden reader (mne-tools#13458) ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants