Repository navigation
MAINT: Add tools dependency group and use it in workflows - #14613
ishaaaan17 wants to merge 4 commits into
Conversation
drammock
left a comment
There was a problem hiding this comment.
@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)
| - uses: actions/[email protected] | ||
| - run: pip install --upgrade gitpython numpy vulture | ||
| - run: | | ||
| python -m pip install --upgrade "pip>=25.1" | ||
| pip install --group tools |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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.
| uv pip install --group tools | ||
| python tools/write-pixi-toml.py |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
| # Dependencies for scripts in the /tools directory | ||
| tools = [ | ||
| "ast-comments", | ||
| "black", |
There was a problem hiding this comment.
where is black coming from? AFAIK we only use ruff nowadays
There was a problem hiding this comment.
tools/dev/generate_pyi_files.py still uses black.format_str() to format the generated .pyi stubs.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
(same with ast_comments package too)
There was a problem hiding this comment.
Agreed let's get rid of that .py file and its associated reqs (black, ast_comments) !
| - 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 |
There was a problem hiding this comment.
weird that rcssmin is getting dropped, makes me again suspicious that mixing uv pip and pixi isn't working as expected.
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
| python-version: "3.13" |
Reference issue (if any)
Fixes #13683.
What does this implement/fix?
toolsgroup under[dependency-groups]inpyproject.tomlwith the third-party packages used by scripts intools/and their workflows (ast-comments,black,codespell,gitpython,numpy,packaging,pygithub,pyyaml,rcssmin >= 1.1,sphinx,tomlkit,tqdm,vulture).{ include-group = "tools" }indevand movercssmin >= 1.1fromdevtotools.--group toolsacross.github/workflows/autofix.yml,.github/workflows/credit.yml,.github/workflows/scheduled_updates.yml, and.github/workflows/sponsor_review.yml.Additional information
toml-sort,yamllint,zizmor,tools/check_pyproject_helpers.py,tools/write-pixi-toml.pydry-run, anduvresolution across Python 3.11–3.14 and thedevgroup.tools/imports and workflows with Gemini, reviewed the changes, and tested dependency resolution and pre-commit checks locally.