pixi icon indicating copy to clipboard operation
pixi copied to clipboard

Improvement ideas for `pixi search`

Open pavelzw opened this issue 2 years ago • 11 comments

Problem description

In https://github.com/mamba-org/mamba/pull/2823 and https://github.com/mamba-org/mamba/pull/2782 there have been some nice improvements for micromamba search. It would be great if pixi could also get some of the features.

`micromamba search pandas=2.1`
❯ micromamba search pandas=2.1
Getting repodata from channels...

conda-forge/osx-arm64                                       Using cache
conda-forge/noarch                                          Using cache
qc-internal/osx-arm64                                       Using cache
qc-internal/noarch                                          Using cache


pandas 2.1.1 py310h5924a0a_0 (+ 6 builds)
─────────────────────────────────────────

 Name            pandas
 Version         2.1.1
 Build           py310h5924a0a_0
 Size            11757 kB
 License         BSD-3-Clause
 Subdir          osx-arm64
 File Name       pandas-2.1.1-py310h5924a0a_0.conda
 URL             https://*****conda.anaconda.org/conda-forge/osx-arm64/pandas-2.1.1-py310h5924a0a_0.conda
 MD5             6122cea23eb5a36b9470622a5df282da
 SHA256          39d365ab5e6415342295c63ebbf810eca015b94bd7e87135c7ff74975cd2af6e

 Dependencies:
  - libcxx >=15.0.7
  - numpy >=1.22.4,<2.0a0
  - python >=3.10,<3.11.0a0
  - python >=3.10,<3.11.0a0 *_cpython
  - python-dateutil >=2.8.1
  - python-tzdata >=2022a
  - python_abi 3.10.* *_cp310
  - pytz >=2020.1

 Other Versions (1):

  Version Build
 ──────────────────────────────────────
  2.1.0   py310h5924a0a_0 (+ 2 builds)
`micromamba search pandas=2.1 -v`
❯ micromamba search pandas=2.1 -v
Getting repodata from channels...

      pandas 2.1.1 py310h5924a0a_0
────────────────────────────────────────

 Name            pandas
 Version         2.1.1
 Build           py310h5924a0a_0
 Size            11757 kB
 License         BSD-3-Clause
 Subdir          osx-arm64
 File Name       pandas-2.1.1-py310h5924a0a_0.conda
 URL             https://*****conda.anaconda.org/conda-forge/osx-arm64/pandas-2.1.1-py310h5924a0a_0.conda
 MD5             6122cea23eb5a36b9470622a5df282da
 SHA256          39d365ab5e6415342295c63ebbf810eca015b94bd7e87135c7ff74975cd2af6e

 Dependencies:
  - python_abi 3.10.* *_cp310
  - python >=3.10,<3.11.0a0
  - python >=3.10,<3.11.0a0 *_cpython
  - libcxx >=15.0.7
  - numpy >=1.22.4,<2.0a0
  - python-dateutil >=2.8.1
  - pytz >=2020.1
  - python-tzdata >=2022a

 Other Builds (9):

  Version Build
 ───────────────────────────
  2.1.1   py310h5924a0a_1
  2.1.1   py311h9e438b8_1
  2.1.1   py39h425d09f_0
  2.1.1   py39h425d09f_1
  2.1.1   py312h58738bf_1
  2.1.1   py311h9e438b8_0
  2.1.0   py310h5924a0a_0
  2.1.0   py311h9e438b8_0
  2.1.0   py39h425d09f_0

I am currently missing in pixi search is the ability to show multiple versions of packages as well as the build strings. I also think that the best match could display more metadata like with the new implementation of micromamba search.

pavelzw avatar Oct 04 '23 16:10 pavelzw

That looks good! I would glady accept PRs! Maybe @Wackyator ? since you build the initial search?

baszalmstra avatar Oct 04 '23 17:10 baszalmstra

The wildcard search is fixed in #578 but there is still more we could improve.

  • Search for specific versions of a package using the match spec e.g. pixi search python==3.10.0
  • The verbosity flag that @pavelzw suggests to get all versions.
  • Print a link to prefix.dev to get even more info on the package.

Possibly more, share your ideas!

ruben-arts avatar Jan 04 '24 09:01 ruben-arts

pixi search --json would be nice too.

❯ micromamba search pytest=6.2.2 --json
{
    "query": {
        "query": "pytest =6.2.2*",
        "type": "search"
    },
    "result": {
        "msg": "",
        "pkgs": [
            {
                "build": "py38h10201cd_0",
                "build_number": 0,
                "build_string": "py38h10201cd_0",
                "channel": "conda-forge",
                "constrains": [
                    "pytest-faulthandler >=2"
                ],
                "depends": [
                    "packaging",
                    "toml",
                    "iniconfig",
                    "python_abi 3.8.* *_cp38",
                    "python >=3.8,<3.9.0a0",
                    "attrs >=19.2.0",
                    "py >=1.8.2",
                    "more-itertools >=4.0.0",
                    "pluggy >=0.12,<1.0.0a1"
                ],
                "fn": "pytest-6.2.2-py38h10201cd_0.tar.bz2",
                "license": "MIT",
                "md5": "f8a654a6333435956fefaf51045047fe",
                "name": "pytest",
                "sha256": "8e9323ce0b47273b2f3df9a5fc1fbc6e9f9897515e88307fcde7589bc3d9de22",
                "size": 442348,
                "subdir": "osx-arm64",
                "timestamp": 1611752118,
                "track_features": "",
                "url": "https://conda.anaconda.org/conda-forge/osx-arm64/pytest-6.2.2-py38h10201cd_0.tar.bz2",
                "version": "6.2.2"
            },
            {
                "build": "py39h2804cbe_0",
                "build_number": 0,
                "build_string": "py39h2804cbe_0",
                "channel": "conda-forge",
                "constrains": [
                    "pytest-faulthandler >=2"
                ],
                "depends": [
                    "packaging",
                    "toml",
                    "iniconfig",
                    "python_abi 3.9.* *_cp39",
                    "python >=3.9,<3.10.0a0",
                    "attrs >=19.2.0",
                    "py >=1.8.2",
                    "more-itertools >=4.0.0",
                    "pluggy >=0.12,<1.0.0a1"
                ],
                "fn": "pytest-6.2.2-py39h2804cbe_0.tar.bz2",
                "license": "MIT",
                "md5": "dec19445bac6ed9e535744e7f1c5269d",
                "name": "pytest",
                "sha256": "da5c9d835301451b4093a91463124b2a5b5975da9280fa95b21a1c70c7f25beb",
                "size": 442665,
                "subdir": "osx-arm64",
                "timestamp": 1611752232,
                "track_features": "",
                "url": "https://conda.anaconda.org/conda-forge/osx-arm64/pytest-6.2.2-py39h2804cbe_0.tar.bz2",
                "version": "6.2.2"
            }
        ],
        "status": "OK"
    }
}   

pavelzw avatar Mar 01 '24 13:03 pavelzw

Would it be in-line with the vision of pixi search to make it work nearly identically to conda search?

I was inspired to ask based on this question on discord: https://discord.com/channels/1082332781146800168/1266482869954416843/1266482869954416843

I usually reach for conda search when I'm trying to explore repository content, and having conda search return only one result is unhelpful for that. Conda search's output is much more favorable for me.

$ conda search "python>=3.12"
...
python                        3.12.0 hab00c5b_0_cpython  conda-forge 
python                        3.12.1 hab00c5b_0_cpython  conda-forge 
python                        3.12.1 hab00c5b_1_cpython  conda-forge 
python                        3.12.2 hab00c5b_0_cpython  conda-forge 
python                        3.12.3 hab00c5b_0_cpython  conda-forge 
python                        3.12.4 h194c7f8_0_cpython  conda-forge 

And then I can make this detailed by passing -i:

python 3.12.4 h194c7f8_0_cpython
--------------------------------
file name   : python-3.12.4-h194c7f8_0_cpython.conda
name        : python
version     : 3.12.4
build       : h194c7f8_0_cpython
build number: 0
size        : 30.6 MB
license     : Python-2.0
subdir      : linux-64
url         : http://lxc-nginx-internal.lan/conda/conda-forge/linux-64/python-3.12.4-h194c7f8_0_cpython.conda
md5         : d73490214f536cccb5819e9873048c92
timestamp   : 2024-06-17 10:56:11 UTC
constraints : 
  - python_abi 3.12.* *_cp312
dependencies: 
  - bzip2 >=1.0.8,<2.0a0
  - ld_impl_linux-64 >=2.36.1
  - libexpat >=2.6.2,<3.0a0
  - libffi >=3.4,<4.0a0
  - libgcc-ng >=12
  - libnsl >=2.0.1,<2.1.0a0
  - libsqlite >=3.46.0,<4.0a0
  - libuuid >=2.38.1,<3.0a0
  - libxcrypt >=4.4.36
  - libzlib >=1.3.1,<2.0a0
  - ncurses >=6.5,<7.0a0
  - openssl >=3.3.1,<4.0a0
  - readline >=8.2,<9.0a0
  - tk >=8.6.13,<8.7.0a0
  - tzdata
  - xz >=5.2.6,<6.0a0
  - pip

[ and so on ]

However, this is in contrast to issue #970 which suggests that the pixi search should instead be context-dependent, i.e. have different behavior within pixi projects than without.

So I'd like clarity from maintainers if they have a preference for what this feature shapes out to before considering contributing a solution that may be rejected immediately!

AaronOpfer avatar Jul 28 '24 14:07 AaronOpfer

Over in #1827 I posted that the wildcard search seems to be a little too fuzzy, pixi search "gcc*" for example gives a huge number of unrelated results

benmoss avatar Aug 16 '24 15:08 benmoss

I would also suggest that pixi search can find substrings.

As of now, it seems limiting that pylsp will not find pylsp-mypy and pylsp-rope for some reason.

I found that conda-forge can do that (as most search engines), and maybe we can connect to its API.

https://conda-forge.org/packages/

ShalokShalom avatar Oct 26 '25 22:10 ShalokShalom

Connecting via API is a bad idea as this is not standardized anywhere and it won't work with mirrors like artifactory, prefix.dev, ...

Also, most things are already doable using the rattler_repodata_gateway crate.

pavelzw avatar Oct 27 '25 02:10 pavelzw

Also, doesn't pixi search pylsp'*' already do the right thing?

pavelzw avatar Oct 27 '25 02:10 pavelzw

Couldn't it be automatically infered, as its in almost every other search engine as well?

ShalokShalom avatar Oct 27 '25 12:10 ShalokShalom

I think we should lean into matchspecs (especially once https://github.com/conda/rattler/pull/1480 is implemented) as they are a well defined standard in the conda ecosystem that allows you to specify packages. Once they get glob support in rattler, we should be able to query everything through matchspecs.

pavelzw avatar Oct 27 '25 14:10 pavelzw

I understand this would solve this issue.

ShalokShalom avatar Oct 27 '25 14:10 ShalokShalom