8000 DEV add missing dep to lock-file script docstring by lucascolley · Pull Request #30574 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

DEV add missing dep to lock-file script docstring #30574

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

Merged
merged 2 commits into from
Jan 3, 2025

Conversation

lucascolley
Copy link
Contributor

hi @lesteve! closes gh-30571

Copy link
github-actions bot commented Jan 3, 2025

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 3bfd231. Link to the linter CI: here

Copy link
Member
@lesteve lesteve left a comment

Choose a reason for hiding this comment

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

Thanks, I think it was noted by @adrinjalali at one point indeed ...

I have moved to micromamba not too long ago and I may have a look at one point but to be honest this is very unlikely to be at the top of my priorities ...

@lesteve lesteve enabled auto-merge (squash) January 3, 2025 15:34
@lucascolley
Copy link
Contributor Author

just wait and hope that someone sets pixi up!

@lesteve
Copy link
Member
lesteve commented Jan 3, 2025

just wait and hope that someone sets pixi up!

Honestly I'd like to but this seems like may take a while ...

I mean if someone was setting up something like https://github.com/rgommers/pixi-dev-scipystack for scikit-learn I'd be willing to give it a go in my day to day scikit-learn work ... @lucascolley are you using something like this for scipy out of curiosity?

For scikit-learn to completely switch to pixi I would say one of the technical hurdle is pixi lock-file size prefix-dev/pixi#1509. since lock-files are in our repo and we don't want to incur the CI churn that goes with updating lock-files every week. See #22448 (comment) where I did some quick and dirty estimates of the repo growth due to CI lock files updates.

For completeness, I just did a quick comparison and pixi lock files seems about 5x bigger in our use case.

❯ ls -ltrh *.lock    
-rw-r--r-- 1 lesteve lesteve 18K Jan  3 17:36 conda.lock
-rw-r--r-- 1 lesteve lesteve 92K Jan  3 17:37 pixi.lock

I generated pixi.lock with:

pixi add python numpy scipy cython joblib threadpoolctl matplotlib pandas pyamg pytest pytest-xdist pillow pip ninja meson-python pytest-cov coverage ccache polars

and conda.lock with

# environment.yml
channels:
  - conda-forge
dependencies:
  - python
  - numpy
  - scipy
  - cython
  - joblib
  - threadpoolctl
  - matplotlib
  - pandas
  - pyamg
  - pytest
  - pytest-xdist
  - pillow
  - pip
  - ninja
  - meson-python
  - pytest-cov
  - coverage
  - ccache
  - polars
conda-lock lock --mamba --kind explicit --platform linux-64 --file environment.yml --filename-template conda.lock

@lucascolley
Copy link
Contributor Author
lucascolley commented Jan 3, 2025

yes, I use rgommers/pixi-dev-scipystack for 100% of my SciPy work and it seems stable. It also seems quite far off to integrate pixi into the main repo for SciPy. Perhaps using it for CI environments is a little more within reach.

Out of interest, which version of pixi are you using? I know that the lock-file size reduced in a relatively recent update, but maybe you already have that.

@lesteve
Copy link
Member
lesteve commented Jan 3, 2025

yes, I use rgommers/pixi-dev-scipystack for 100% of my SciPy work and it seems stable. It also seems quite far off to integrate pixi into the main repo for SciPy. Perhaps using it for CI environments is a little more within reach.

Good to know, maybe it's just a matter of getting the motivation of putting together a scikit-learn setup then!

Out of interest, which version of pixi are you using? I know that the lock-file size reduced in a relatively recent update, but maybe you already have that.

Thanks, I was using a somewhat older version but I just tried with the latest pixi version ( Pixi will be updated from 0.28.2 to 0.39.4) and still have the same result maybe there is a special incantation to reduce the lock-file size ...

@lesteve
Copy link
Member
lesteve commented Jan 3, 2025

Looks like [ci skip] was preventing Circle to run and the required checks to be satisfied see Circle CI build log, I merged main into the branch and hopefully it should be merged automatically.

Isn't CI such a wonderful world 🙃 ...

Side-comment Azure does not care about [ci skip] apparently oh well maybe an advantage (this way you can not sneak in a [ci skip] making it look like CI is green?) ...

@lucascolley
Copy link
Contributor Author
lucascolley commented Jan 3, 2025

Good to know, maybe it's just a matter of getting the motivation of putting together a scikit-learn setup then!

I took a brief look. Is scikit-learn set-up for non-editable meson installs? Editable installs do not work with meson-python without with build isolation, but uv and pixi require build isolation - see astral-sh/uv#10214.

@lesteve lesteve merged commit e5b78f0 into scikit-learn:main Jan 3, 2025
28 checks passed
@lucascolley lucascolley deleted the lockfile-deps branch January 3, 2025 18:31
@lesteve
Copy link
Member
lesteve commented Jan 4, 20 8000 25

I took a brief look. Is scikit-learn set-up for non-editable meson installs? Editable installs do not work with meson-python without with build isolation, but uv and pixi require build isolation - see astral-sh/uv#10214.

Nice thanks for investigating this! I guess that's the kind of problem that can happen with shiny new tools, you end-up alone in weird corners that are a bit outside the beaten path 😅 ...

scikit-learn is not set-up for non-editable meson install. Depending on how complicated the issue seems to be on the pixi/uv side, I would be open to add spin build for scikit-learn as as stop-gap solution. But then spin status is very experimental in scikit-learn and if one day we switch to pixi this allows to remove spin not have pixi tasks that call spin, to prevent too many tools preventing to have a simple picture of what is going on see discussion in #29012 for example ...

More context: historically scikit-learn moved to meson late and meson editable install existed and kind of almost worked 1 . The meson editable install looked similar to what we were used to and works better inside an IDE according to scipy doc. I did not see any reason to have two ways to do a similar things and complicate the situation further. Also I wanted to avoid coupling Meson (already quite tricky) to adopting spin.

Footnotes

  1. if you really want to know there were some quirks that we discovered e.g. https://github.com/mesonbuild/meson-python/issues/568 and https://github.com/mesonbuild/meson-python/issues/557. There is still https://github.com/mesonbuild/meson-python/issues/646 but unlikely to be high priority any time soon ...

jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Jan 8, 2025
jeremiedbb pushed a commit to jeremiedbb/scikit-learn that referenced this pull request Jan 8, 2025
@lesteve
Copy link
Member
lesteve commented Feb 5, 2025

@lucascolley apparently @glemaitre has a pixi setup that works for him and should be similar enough to your setup: https://github.com/glemaitre/scikit-learn-workspace.

I would be curious to know how it is different to your setup that avoids the uv issue with meson editable install, but I don't have time to look into this 😅 ...

@lesteve
Copy link
Member
lesteve commented Feb 6, 2025

So I guess you are saying this is the key:

[feature.build.pypi-options]
no-build-isolation = ["scikit-learn"]

@lucascolley
Copy link
Contributor Author

Yes, sorry if that wasn't obvious haha! I wasn't aware that that pixi option exists, but it seems like what we need for an editable meson-python install.

@betatim
Copy link
Member
betatim commented Feb 10, 2025

What problem does pixi (or in general having a lockfile) for scikit-learn development solve?

AFAIK we have a good guide that contains just a handful of commands (https://scikit-learn.org/dev/developers/advanced_installation.html#building-from-source) to get setup and running. If we couldn't achieve this, say you'd have to have pinned versions of the dependencies or a much longer list of them, then I could see what pixi offers. My assumption is that using pixi is mostly about having lockfiles?

@adrinjalali
Copy link
Member

those handful commands don't replace a pixi workflow though. I've been using pixi in at least 2 projects now, and my workflow is now mostly

pixi run -e ci-sklearn12 tests -svl                 

where ci-sklearn12 is a specific CI specification/dependencies, tests calls pytest, and -svl are pytest args.

On top of that, I often do

pixi shell -e ci-sklearn12

to get a shell into that environment. In an IDE like vscode, pixi envs are recognised and can be used as the interpreter easily and switch between them.

The workflow is certainly not bug-free and has issues, but it has made my dev life much happier there.

@lucascolley
Copy link
Contributor Author

Another huge benefit is for reproducibility / helping new contributors. Rather than saying "follow these 10 commands" and having to worry about different system setups or mistakes following the commands, it's usually just 1) install pixi 2) run this one command.

But perhaps the biggest benefit is when you need different envs for different tasks. It looks like Guillaume's setup isn't quite that complex yet, but take a look at https://github.com/rgommers/pixi-dev-scipystack/blob/main/scipy/pixi.toml. Managing all of that alternative backend development via conda environments had started to become a huge pain for me.

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.

extra dependency needed for update lockfiles script
4 participants
0