Skip to content

MAINT: Add tools dependency group and use it in workflows - #14613

Open
ishaaaan17 wants to merge 4 commits into
mne-tools:mainfrom
ishaaaan17:maint/tools-dependency-group
Open

ishaaaan17 wants to merge 4 commits into
mne-tools:mainfrom
ishaaaan17:maint/tools-dependency-group

Conversation

@ishaaaan17

@ishaaaan17 ishaaaan17 commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Reference issue (if any)

Fixes #13683.

What does this implement/fix?

  • Add a tools group under [dependency-groups] in pyproject.toml with the third-party packages used by scripts in tools/ and their workflows (ast-comments, black, codespell, gitpython, numpy, packaging, pygithub, pyyaml, rcssmin >= 1.1, sphinx, tomlkit, tqdm, vulture).
  • Include { include-group = "tools" } in dev and move rcssmin >= 1.1 from dev to tools.
  • Replace manual tool dependency installs with --group tools across .github/workflows/autofix.yml, .github/workflows/credit.yml, .github/workflows/scheduled_updates.yml, and .github/workflows/sponsor_review.yml.

Additional information

  • Verified locally with toml-sort, yamllint, zizmor, tools/check_pyproject_helpers.py, tools/write-pixi-toml.py dry-run, and uv resolution across Python 3.11–3.14 and the dev group.
  • AI disclosure: I audited tools/ imports and workflows with Gemini, reviewed the changes, and tested dependency resolution and pre-commit checks locally.

@drammock drammock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@ishaaaan17 please ping @tsbinns and @scott-huberty for the next round of review (but feel free to ping me if my comments are unclear / you have questions about my review)

Comment on lines 27 to +30
- uses: actions/[email protected]
- run: pip install --upgrade gitpython numpy vulture
- run: |
python -m pip install --upgrade "pip>=25.1"
pip install --group tools

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I notice here that we're not requesting a specific version of python from actions/setup-python. If we were, we could know already which version of pip is already there (it's bundled, not downloaded, so stdlib's ensurepip.version() will tell you). In which case, we might not need the --upgrade line.

I think it's fine as it is for now, but I'll open a separate issue about it, since in general we should be declaring which python version we want from actions/setup-python (it falls back to "whatever version is on PATH in the runner" which isn't guaranteed stable, and may not be that easy to determine w/o SSHing into the runner)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

makes sense to me, leaving the pip>=25.1 upgrade as it is for now so it keeps working regardless of the runner's default python.

Comment on lines +103 to +104
uv pip install --group tools
python tools/write-pixi-toml.py

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this isn't wrong per say, and I can't say for sure by looking that it is broken, but it's odd to mix and match uv pip and pixi here. I realize we're switching back and forth between them already (and probably shouldn't be, but at least it's for separate CI specs: uv for the "old" CI job, and pixi for the "macos-intel" job). Here you're using both uv and pixi for the same job, and I'm worried that e.g. they may be targeting different Python executables (green CIs on this PR don't necessarily mean that this still works, since it only runs when pyproject.toml is dirty).

@ishaaaan17 Can you find a comparable way to do pip install --group tools via pixi instead of uv? If not, then @tsbinns and/or @scott-huberty can you weigh in / verify if we're good here?

@ishaaaan17 ishaaaan17 Nov 30, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I checked Pixi's CLI/docs and couldn't find a clean equivalent without changing how Pixi is configured here: pixi exec only takes -s/-w package specs rather than a --group flag, and running [dependency-groups] directly via pixi run -e tools would require adding [tool.pixi.*] workspace config to the root pyproject.toml (whereas MNE keeps Pixi config in tools/ci/macos-intel/pixi.toml).

In this job setup-uv already activates a Python 3.12 venv earlier on, so uv pip install --group tools and write-pixi-toml.py both run in that venv, and pixi lock --no-install resolves tools/ci/macos-intel/pixi.toml independently

@tsbinns @scott-huberty do you see any issue with keeping uv and pixi like this here?

Comment thread .github/workflows/credit.yml Resolved
Comment thread .github/workflows/scheduled_updates.yml Resolved
Comment thread pyproject.toml
# Dependencies for scripts in the /tools directory
tools = [
"ast-comments",
"black",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

where is black coming from? AFAIK we only use ruff nowadays

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

tools/dev/generate_pyi_files.py still uses black.format_str() to format the generated .pyi stubs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I suspect that we don't really need generate_pyi_files.py anymore (and hence don't need black either). @larsoner do you agree? to me it looks like a one-time script to automate our adoption of lazy_loader.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

(same with ast_comments package too)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agreed let's get rid of that .py file and its associated reqs (black, ast_comments) !

Comment on lines -6737 to -6748
- conda: https://conda.anaconda.org/conda-forge/osx-64/rcssmin-1.2.2-py313h71da6e4_2.conda
sha256: 08c7d3134a3eaaf1b6c4bc1fab761a010e294f4aab3ed93c2baa37e57fadd183
md5: 82003638723717ab2f343621a214f3b0
depends:
- __osx >=11.0
- python >=3.13,<3.14.0a0
- python_abi 3.13.* *_cp313
license: Apache-2.0 AND BSD-3-Clause
purls:
- pkg:pypi/rcssmin?source=hash-mapping
size: 34563
timestamp: 1788627708135

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

weird that rcssmin is getting dropped, makes me again suspicious that mixing uv pip and pixi isn't working as expected.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's from tools/write-pixi-toml.py rather than uv vs pixi — it filters dependency-groups.dev with isinstance(x, str), so moving rcssmin >= 1.1 into tools (behind { include-group = "tools" } ) skipped it. As far as I saw rcssmin is only used by tools/dev/gen_css_for_mne.py and not in tests, so dropping it from the macOS Intel env shouldn't break anything.

version: ">=0.9"
activate-environment: true
enable-cache: false
python-version: "3.12"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
python-version: "3.13"

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tools script deps to a dev dependency group in pyproject.toml

4 participants