Skip to content

fix(cli): use mp.suspend for pixi_progress::println!#5459

Merged
Hofer-Julian merged 2 commits intoprefix-dev:mainfrom
lucascolley:tasks_newline
Mar 16, 2026
Merged

fix(cli): use mp.suspend for pixi_progress::println!#5459
Hofer-Julian merged 2 commits intoprefix-dev:mainfrom
lucascolley:tasks_newline

Conversation

@lucascolley
Copy link
Collaborator

Description

This PR fixes newline printing for some situations in the CLI.

Before (spaces):

✨ Pixi task (build in build): spin build --setup-args=-Dblas=blas --setup-args=-Dlapack=lapack --setup-args=-Duse-g77-abi=true: (Build SciPy (default settings))
$ meson compile -j 8 -C build
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /Users/lucascolley/ghq/github.com/scipy/scipy/.pixi/envs/build/bin/ninja -C /Users/lucascolley/ghq/github.com/scipy/scipy/build -j 8
ninja: Entering directory `/Users/lucascolley/ghq/github.com/scipy/scipy/build'
[2/356] Generating subprojects/highs/highs/HConfig.h with a custom command
$ meson install --only-changed -C build --destdir ../build-install --tags=runtime,python-runtime,tests,devel --skip-subprojects
                                                                                                                             ✨ Pixi task (ipython in ipython): spin ipython --no-build: (Launch IPython)                                                 $ export PYTHONPATH="/Users/lucascolley/ghq/github.com/scipy/scipy/build-install/usr/lib/python3.14/site-packages"
💻 Launching IPython with PYTHONPATH="/Users/lucascolley/ghq/github.com/scipy/scipy/build-install/usr/lib/python3.14/site-packages"

After (newlines):

✨ Pixi task (build in build): spin build --setup-args=-Dblas=blas --setup-args=-Dlapack=lapack --setup-args=-Duse-g77-abi=true: (Build SciPy (default settings))
$ meson compile -j 8 -C build
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /Users/lucascolley/ghq/github.com/scipy/scipy/.pixi/envs/build/bin/ninja -C /Users/lucascolley/ghq/github.com/scipy/scipy/build -j 8
ninja: Entering directory `/Users/lucascolley/ghq/github.com/scipy/scipy/build'
[2/356] Generating subprojects/highs/highs/HConfig.h with a custom command
$ meson install --only-changed -C build --destdir ../build-install --tags=runtime,python-runtime,tests,devel --skip-subprojects

✨ Pixi task (ipython in ipython): spin ipython --no-build: (Launch IPython)
$ export PYTHONPATH="/Users/lucascolley/ghq/github.com/scipy/scipy/build-install/usr/lib/python3.14/site-packages"
💻 Launching IPython with PYTHONPATH="/Users/lucascolley/ghq/github.com/scipy/scipy/build-install/usr/lib/python3.14/site-packages"

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.

Tools: ChatGPT

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added sufficient tests to cover my changes.
  • I have verified that changes that would impact the JSON schema have been made in schema/model.py.

@lucascolley lucascolley added bug Something isn't working cli Issue related to CLI labels Feb 6, 2026
@baszalmstra
Copy link
Contributor

I dont see how this fixes the issue? This is doing essentially the same thing? Should we not also deal with the hidden case?

@lucascolley
Copy link
Collaborator Author

lucascolley commented Feb 6, 2026

I dont see how this fixes the issue? This is doing essentially the same thing?

mp.println prints spaces rather than a new line, this avoids that

Should we not also deal with the hidden case?

I think the mp.suspend just becomes an 'identity'/'null' closure (sorry I don't know the word) in the hidden case

@lucascolley
Copy link
Collaborator Author

but yeah I'm not sure if this breaks anything where we are calling pixi_progress::println! in the context of multiple progress bars. If it does then I guess we want to introduce a new macro like pixi_progress::printnewln!?

@lucascolley
Copy link
Collaborator Author

Should we not also deal with the hidden case?

I think the mp.suspend just becomes an 'identity'/'null' closure (sorry I don't know the word) in the hidden case

or maybe it is still necessary, looking at https://docs.rs/indicatif/latest/indicatif/struct.ProgressBar.html#method.println

@baszalmstra
Copy link
Contributor

Maybe just change the mp.println to mp.suspend then?

@lucascolley
Copy link
Collaborator Author

lucascolley commented Feb 7, 2026

Maybe just change the mp.println to mp.suspend then?

I think the current implementation is more concise and probably effectively equivalent, but feel free to push a change.

@baszalmstra
Copy link
Contributor

Can you confirm that this also still works when you run pixi with --no-progress?

@lucascolley
Copy link
Collaborator Author

Can you confirm that this also still works when you run pixi with --no-progress?

yep!

scipy on 🎋 main is 📦 v1.18.0.dev0 via 🐍 via 🧚 v0.63.2 took 18stixi run --no-progress ipython
✨ Pixi task (build in build): spin build --setup-args=-Dblas=blas --setup-args=-Dlapack=lapack --setup-args=-Duse-g77-abi=true: (Build SciPy (default settings))
$ meson compile -j 8 -C build
INFO: autodetecting backend as ninja
INFO: calculating backend command to run: /Users/lucascolley/ghq/github.com/scipy/scipy/.pixi/envs/build/bin/ninja -C /Users/lucascolley/ghq/github.com/scipy/scipy/build -j 8
ninja: Entering directory `/Users/lucascolley/ghq/github.com/scipy/scipy/build'
[2/356] Generating subprojects/highs/highs/HConfig.h with a custom command
$ meson install --only-changed -C build --destdir ../build-install --tags=runtime,python-runtime,tests,devel --skip-subprojects

✨ Pixi task (ipython in ipython): spin ipython --no-build: (Launch IPython)
$ export PYTHONPATH="/Users/lucascolley/ghq/github.com/scipy/scipy/build-install/usr/lib/python3.14/site-packages"
💻 Launching IPython with PYTHONPATH="/Users/lucascolley/ghq/github.com/scipy/scipy/build-install/usr/lib/python3.14/site-packages"

@lucascolley
Copy link
Collaborator Author

@baszalmstra @Hofer-Julian @ruben-arts what do you think about merging this, and reverting if we notice any problems?

@Hofer-Julian
Copy link
Contributor

@lucascolley I would like to test this locally before merging. Could you please point me at a reproducer?

@lucascolley
Copy link
Collaborator Author

checkout https://github.com/scipy/scipy and resize your terminal after pixi run ipython

Copy link
Contributor

@Hofer-Julian Hofer-Julian left a comment

Choose a reason for hiding this comment

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

I tested this locally, and it fixes the problem @lucascolley described.
Also, --no-progress behaves exactly as expected.

On top of that it actually deletes code, I will go ahead and merge this.

Thank you for your patience, Lucas!

@Hofer-Julian Hofer-Julian merged commit 03ba352 into prefix-dev:main Mar 16, 2026
37 checks passed
@lucascolley lucascolley deleted the tasks_newline branch March 16, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cli Issue related to CLI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants