prefix-dev / pixi

Package management made easy
https://pixi.sh
BSD 3-Clause "New" or "Revised" License
3.23k stars 178 forks source link

Improvement ideas for `pixi search` #378

Open pavelzw opened 1 year ago

pavelzw commented 1 year ago

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.

baszalmstra commented 1 year ago

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

ruben-arts commented 10 months ago

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

Possibly more, share your ideas!

pavelzw commented 8 months ago

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"
    }
}   
AaronOpfer commented 3 months ago

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!

benmoss commented 2 months ago

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