Skip to content

fix: Pretty print short result for mamba search by default#4066

Merged
JohanMabille merged 2 commits into
mamba-org:mainfrom
kuepe-sl:fix-search-output
Feb 18, 2026
Merged

fix: Pretty print short result for mamba search by default#4066
JohanMabille merged 2 commits into
mamba-org:mainfrom
kuepe-sl:fix-search-output

Conversation

@kuepe-sl
Copy link
Copy Markdown
Contributor

@kuepe-sl kuepe-sl commented Sep 18, 2025

Description

mamba search without wildcards is supposed to auto-enable pretty printing. (with package info)
mamba search with wildcards should just print everything as a table.

Currently, it does the opposite, spamming the terminal with lots of package details when a wildcard is used. (see below for an example with the opencv package)

This PR fixes the issue and makes it work the way it should.

Type of Change

  • Bugfix
  • Feature / enhancement
  • CI / Documentation
  • Maintenance

Checklist

  • My code follows the general style and conventions of the codebase, ensuring consistency
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have run pre-commit run --all locally in the source folder and confirmed that there are no linter errors.
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes

Other

current output:

$ mamba search "opencv"
Getting repodata from channels...

conda-forge/linux-64                                        Using cache
conda-forge/noarch                                          Using cache
 Name   Version  Build                                          Channel     Subdir  
─────────────────────────────────────────────────────────────────────────────────────
 opencv 4.9.0    headless_py310h18fe71b_12       (+ 161 builds) conda-forge linux-64
 opencv 4.8.1    py310h60d20e8_4                 (+  44 builds) conda-forge linux-64
 opencv 4.8.0    py310hff52083_0                 (+  26 builds) conda-forge linux-64
 opencv 4.7.0    py310hff52083_0                 (+  41 builds) conda-forge linux-64
 opencv 4.6.0    py310hff52083_7                 (+  59 builds) conda-forge linux-64
 opencv 4.5.5    py310hff52083_10                (+  63 builds) conda-forge linux-64
 opencv 4.5.3    py310hff52083_8                 (+  27 builds) conda-forge linux-64
 opencv 4.5.2    py36h5fab9bb_0                  (+   8 builds) conda-forge linux-64
 opencv 4.5.1    py36h5fab9bb_0                  (+   9 builds) conda-forge linux-64
 opencv 4.5.0    py36_0                          (+  30 builds) conda-forge linux-64
 opencv 4.4.0    py36_2                          (+   6 builds) conda-forge linux-64
 opencv 4.3.0    py36_0                          (+   8 builds) conda-forge linux-64
 opencv 4.2.0    py27_0                          (+  26 builds) conda-forge linux-64
 opencv 4.12.0   headless_py310h89e5e42_0        (+  45 builds) conda-forge linux-64
 opencv 4.11.0   headless_py310h1766cdc_0        (+  99 builds) conda-forge linux-64
 opencv 4.10.0   headless_py310h1766cdc_14       (+ 275 builds) conda-forge linux-64
 opencv 4.1.2    0                               (+   5 builds) conda-forge linux-64
 opencv 4.1.1    3                               (+  10 builds) conda-forge linux-64
 opencv 4.1.0    py27h3aa1047_5                  (+  20 builds) conda-forge linux-64
 opencv 4.0.1    py27_blas_openblash26fe798_200  (+   4 builds) conda-forge linux-64
 opencv 4.0.0    py27_blas_openblash26fe798_200  (+   2 builds) conda-forge linux-64
 opencv 3.4.9    py27_1                          (+   7 builds) conda-forge linux-64
 opencv 3.4.8    py27_7                          (+   3 builds) conda-forge linux-64
 opencv 3.4.7    4                               (+  29 builds) conda-forge linux-64
 opencv 3.4.4    py27_blas_openblash26fe798_1204 (+  21 builds) conda-forge linux-64
 opencv 3.4.3    py27_blas_openblash1006a3a_201  (+   4 builds) conda-forge linux-64
 opencv 3.4.1    py27_blas_openblas_200          (+   8 builds) conda-forge linux-64
 opencv 3.3.0    py27_blas_openblas_200          (+  14 builds) conda-forge linux-64
 opencv 3.2.0    np111py27_blas_openblas_200     (+  32 builds) conda-forge linux-64
 opencv 3.1.0    np110py27_0                     (+  15 builds) conda-forge linux-64
 opencv 2.4.13.4 py27_blas_openblas_0            (+   1 builds) conda-forge linux-64
 opencv 2.4.13   np111py27_0                     (+   4 builds) conda-forge linux-64
 opencv 2.4.12   np110py27_0                     (+   6 builds) conda-forge linux-64
$ mamba search "opencv*"
Getting repodata from channels...

conda-forge/linux-64                                        Using cache
conda-forge/noarch                                          Using cache
opencv 4.10.0 headless_py310h1766cdc_14 (+ 275 builds)
──────────────────────────────────────────────────────

 Name            opencv
 Version         4.10.0
 Build           headless_py310h1766cdc_14
 Size            26 kB
 License         Apache-2.0
 Subdir          linux-64
 File Name       opencv-4.10.0-headless_py310h1766cdc_14.conda
 URL             https://conda.anaconda.org/conda-forge/linux-64/opencv-4.10.0-headless_py310h1766cdc_14.conda
 MD5             33bd9dbaf91cb1e5b765e795bef71267
 SHA256          edf4c40c9b78437ce847b490041ebc6413acd2379a5735cd05d65b21173700c9

 Dependencies:
  - hdf5 >=1.14.3,<1.14.4.0a0
  - libopencv 4.10.0 headless_py310h83326b1_14
  - libprotobuf >=5.28.3,<5.28.4.0a0
  - py-opencv 4.10.0 headless_py310h17dd4f5_14
  - python_abi 3.10.* *_cp310

 Other Versions (32):

  Version Build                                   
 ──────────────────────────────────────────────────
  4.9.0   headless_py310h18fe71b_12 (+ 161 builds)
  4.8.1   py310h60d20e8_4           (+  44 builds)
  ...     (28 hidden versions)                 ...
  2.4.13  np111py27_0               (+   4 builds)
  2.4.12  np110py27_0               (+   6 builds)

opencv-cuda 4.10.0 qt5_py310h89e78a7_709
────────────────────────────────────────

 Name            opencv-cuda
 Version         4.10.0
 Build           qt5_py310h89e78a7_709
 Size            25 kB
 License         Apache-2.0
 Subdir          linux-64
 File Name       opencv-cuda-4.10.0-qt5_py310h89e78a7_709.tar.bz2
 URL             https://conda.linkworks.io/t/*****/get/link-developers/linux-64/opencv-cuda-4.10.0-qt5_py310h89e78a7_709.tar.bz2
 MD5             af89704dc2a3e6d79643b8833316131c
 SHA256          947abc88156c52d879bf5fa0112909c01ecfbe7441c72b204fc7872c1f90a722

 Dependencies:
  - libopencv-cuda 4.10.0 qt5_py310h83c7aba_709
  - libprotobuf >=5.27.5,<5.27.6.0a0
  - py-opencv-cuda 4.10.0 qt5_py310h99a4758_709
  - python_abi 3.10.* *_cp310

@github-actions github-actions Bot added the release::bug_fixes For PRs fixing bugs label Sep 18, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 19, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 51.21%. Comparing base (c9c8729) to head (6a3678d).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
micromamba/src/repoquery.cpp 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4066   +/-   ##
=======================================
  Coverage   51.21%   51.21%           
=======================================
  Files         239      239           
  Lines       28666    28666           
  Branches     3009     3009           
=======================================
  Hits        14681    14681           
  Misses      13982    13982           
  Partials        3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kuepe-sl
Copy link
Copy Markdown
Contributor Author

Is there any chance of this being merged?

Or is there anything that prevents it from being merged?

It is a 1-character change only.

@kuepe-sl
Copy link
Copy Markdown
Contributor Author

@jjerphan Any chance you could have a look at this?

Just getting any sort of feedback would be really appreciated.

Copy link
Copy Markdown
Member

@jjerphan jjerphan left a comment

Choose a reason for hiding this comment

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

Thank you for the heads-up; could you add at least a non-regression test?

@kuepe-sl
Copy link
Copy Markdown
Contributor Author

I will see what I can do ...

It looks like there are at least some tests for pretty-printed output in micromamba/tests/test_list.py : test_list_no_json, so I can possibly figure out what to do there.

@kuepe-sl
Copy link
Copy Markdown
Contributor Author

I added a test to the mamba repoquery search command and verified that:

  • it fails with the currently released version
  • it passes with the patch of this PR

@jjerphan jjerphan changed the title fix: fix automatic pretty printing with "mamba search" fix: Pretty print short result for mamba search by default Feb 16, 2026
Copy link
Copy Markdown
Member

@jjerphan jjerphan left a comment

Choose a reason for hiding this comment

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

Thank you, @kuepe-sl!

I just have rebased your branch onto main.

I think that there are many other UX elements of mamba search which need fixing:

  • the version which is being shown is not the latest one
  • one should be able to see all the builds of a package without using *, which show many more things

@kuepe-sl
Copy link
Copy Markdown
Contributor Author

I think there is 1 thing for the UI I'd like to see:

a switch --table, which enforce the table-style non-pretty-print format.

Currently, searching for e.g. opencv always prints the detailed output and sometimes I'd just like to search for all versions of opencv and have it in the table format.

@jjerphan
Copy link
Copy Markdown
Member

jjerphan commented Feb 16, 2026

Also IMO *'s presence should not trigger a table by default but the pretty print result for all packages whose names match instead.

@JohanMabille
Copy link
Copy Markdown
Member

Thank you for the fix! Do not hesitate to open issues to track the remaining things you'd like to see in the UI.

@JohanMabille JohanMabille merged commit d2adddc into mamba-org:main Feb 18, 2026
36 of 37 checks passed
@kuepe-sl kuepe-sl deleted the fix-search-output branch February 18, 2026 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release::bug_fixes For PRs fixing bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants