-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
use a lockfile for "old" CI job #13490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
hey all, here's a snippet based on what we worked out yesterday, for a script to parse pyproject.toml and generate a requirements file from it after hardening the pins: from pathlib import Path
import requests
import tomllib
from packaging.requirements import Requirement
from packaging.specifiers import SpecifierSet
with open("/path/to/mne/python/pyproject.toml", "rb") as fid:
toml = tomllib.load(fid)
deps = toml["project"]["dependencies"] + toml["dependency-groups"]["test"]
reqs = [Requirement(dep) for dep in deps]
pinned_reqs = [req for req in reqs if ">" in str(req.specifier)]
unpinned_reqs = list(set(reqs) - set(pinned_reqs))
# TODO triage handling of > vs >= For now, just assert that we needn't worry
assert all([">=" in str(req) for req in pinned_reqs])
for req in pinned_reqs:
req.specifier = SpecifierSet(str(req.specifier).replace(">=", "=="))
# TODO make sure pinned version isn't yanked
# recombine pinned and not-pinned
all_reqs = sorted(pinned_reqs + unpinned_reqs, key=str)
outfile = Path("/path/to/mne/python/tools/requirements-ci-old.txt")
outfile.write_text("\n".join([str(req) for req in all_reqs]))After that we can in theory run this to get a pylock file: uv pip compile tools/requirements-ci-old.txt --output-file tools/pylock-ci-old.toml --python-version 3.10
mkdir ~/Desktop/some_temp_dir
cd ~/Desktop/some_temp_dir
uv venv --python 3.10
uv pip sync /path/to/mne/python/tools/pylock-ci-old.toml --python-version 3.10Note the TODO in the first script about pinned version being yanked; I get a warning about scipy 1.11.0 when doing the |
regarding the uv pip compile command (uv 0.8.22 (ade2bdbd2 2025-09-23) : pylock-ci-old.toml throws an error:
I renamed the file to pylock.ci-old.toml, that fixed it |
Co-authored-by: Carina Forster <[email protected]>
for more information, see https://pre-commit.ci
|
Have had a go at trying to sort this, here is what I found: Fixed outdated
|
Yes please add sensible lower pins to test deps as needed |
|
|
| if [[ ${MNE_CI_KIND} == "old" ]]; then | ||
| source .venv/bin/activate | ||
| fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we eliminate these, and change the workflow so that it uses source github_actions_*.sh instead of bash github_actions_*.sh?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having trouble getting this to run.
Activating the venv for the old job and then calling these scripts with source gives an obtuse error Error: Process completed with exit code 1.. That's for github_actions_infos.sh, which is the first one we run after creating the venv. Calling with source also leads to errors in the pip-pre CI.
Calling with bash after activating the venv also fails for github_actions_infos.sh, but with a less obscure error ModuleNotFoundError: No module named 'numpy'. So the venv activation isn't carried through.
Both of these approaches work for me locally.
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
|
Had to adjust some minimum versions further, but the tests are finally passing. Again, I went with what was the latest version available 2 years ago. As part of #13611, We could have a similar check to be super sure the environment matches our expectations, but it might be a bit overkill. WDYT @drammock? |
In principle yes... but that's assuming that we don't accidentally install other packages later in the pipeline somewhere that could install newer versions. So I think there's value in keeping the check in place after any installation steps complete, right before tests are run. The code is very simple and fast to execute so little cost in keeping it around |
This part I think would be overkill... just checking the important ones that we want to change + update (using |
|
@larsoner Okay, I can update the check to compare the main dependencies in the env to those listed in the lockfile. |
|
Also, I'm only just realising that the existing old env approach included
Should we create a new group that only includes |
|
Yeah I think a new group makes sense here |
@tsbinns @nordme @CarinaFo @scott-huberty
Here's the PR with placeholders. I discussed with @larsoner and he prefers that we try
uvfirst; if it doesn't work or is unweildy we can switch topixi(see item 3 below for thoughts on this). In addition to the in-line comments, here are a few notes:tools/uv-ci-old.lockor similarlinux-64systems, so when creating the lockfile we can skip adding support for other platforms.uv.lockis actually going to work; AFAICTuv lockonly works in uv's "project mode" where it writes a bunch of stuff totool.uv.*tables inpyproject.toml. Right now we don't have such tables (and I don't think we should add them in this PR), so we may need to do something a bit unorthodoxed withuv(e.g., write our pins torequirements-ci-old.txt, use uv to convert that topylock.tomlformat, and restore the environment from the pylock file). See if you can get it to work withuv, but also feel free to experiment withpixito see if the flow is simpler/more natural that way.mneinstalled (specifically, the local-to-the-CI clone ofmnethat reflects the PR being built). It may be possible to get a relative path in the lockfile, but if not, we may need omitmnein the lockfile and add/install the local-to-ci clone of MNE after the environment has been activated.