Skip to content
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

Regression in fix for #793? MatchSpec parsing appears to fail when channel is passed as url #869

Open
2 tasks done
cisaacstern opened this issue Sep 20, 2024 · 4 comments

Comments

@cisaacstern
Copy link
Contributor

cisaacstern commented Sep 20, 2024

Checklist

  • I added a descriptive title
  • I searched open reports and couldn't find a duplicate

What happened?

Using the latest py-rattler==0.6.3 I am unable to parse MatchSpecs when the channel is passed as a url. In #793 (comment) the following example is given (copying for visibility here):

>>> from rattler import MatchSpec
>>> m = MatchSpec("https://conda.anaconda.org/conda-forge::python[version=3.9]")
>>> m
MatchSpec("conda-forge::python ==3.9")
>>> m.channel
Channel(name="conda-forge", base_url="https://conda.anaconda.org/conda-forge/")

However on my machine I cannot reproduce this. I have just done the following in an empty directory (on mac M1):

  1. ✨ Create a new pixi project and add py-rattler

    $ pixi init
    $ pixi add --manifest-path pixi.toml py-rattler
    ✔ Added py-rattler >=0.6.3,<0.7
  2. 🔧 Add test_matchspec.py to the project directory (adapted from the previously-mentioned example in MatchSpec parses incorrectly when channel is passes as a URL #793 (comment)):

    # test_matchspec.py
    
    from rattler import MatchSpec
    
    if __name__ == "__main__":
        with_url_channel = MatchSpec("https://conda.anaconda.org/conda-forge::python[version=3.9]")
        print(f"{with_url_channel = }")
        print(f"{with_url_channel.channel = }")
        with_named_channel = MatchSpec("conda-forge::python[version=3.9]")
        print(f"{with_named_channel = }")
        print(f"{with_named_channel.channel = }")
  3. 🤔 Run the script. Note that the with_url_channel does not parse correctly (contrary to the linked example in MatchSpec parses incorrectly when channel is passes as a URL #793):

    $ pixi run --manifest-path pixi.toml -e default python test_matchspec.py
    with_url_channel = MatchSpec("*")
    with_url_channel.channel = None
    with_named_channel = MatchSpec("conda-forge::python ==3.9")
    with_named_channel.channel = Channel(name="conda-forge", base_url="https://conda.anaconda.org/conda-forge/")

For reference, here is the output of pixi list for this environment:

$ pixi list --manifest-path pixi.toml -e default    
Package          Version    Build               Size       Kind   Source
bzip2            1.0.8      h99b78c6_7          120 KiB    conda  bzip2-1.0.8-h99b78c6_7.conda
ca-certificates  2024.8.30  hf0a4a13_0          154.8 KiB  conda  ca-certificates-2024.8.30-hf0a4a13_0.conda
libexpat         2.6.3      hf9b8971_0          62.4 KiB   conda  libexpat-2.6.3-hf9b8971_0.conda
libffi           3.4.2      h3422bc3_5          38.1 KiB   conda  libffi-3.4.2-h3422bc3_5.tar.bz2
libsqlite        3.46.1     hc14010f_0          810.1 KiB  conda  libsqlite-3.46.1-hc14010f_0.conda
libzlib          1.3.1      hfb2fe0b_1          45.8 KiB   conda  libzlib-1.3.1-hfb2fe0b_1.conda
ncurses          6.5        h7bae524_1          783.5 KiB  conda  ncurses-6.5-h7bae524_1.conda
openssl          3.3.2      h8359307_0          2.7 MiB    conda  openssl-3.3.2-h8359307_0.conda
py-rattler       0.6.3      py312h3ddc590_1     3.9 MiB    conda  py-rattler-0.6.3-py312h3ddc590_1.conda
python           3.12.6     h739c21a_0_cpython  12.3 MiB   conda  python-3.12.6-h739c21a_0_cpython.conda
python_abi       3.12       5_cp312             6.1 KiB    conda  python_abi-3.12-5_cp312.conda
readline         8.2        h92ec313_1          244.5 KiB  conda  readline-8.2-h92ec313_1.conda
tk               8.6.13     h5083fa2_1          3 MiB      conda  tk-8.6.13-h5083fa2_1.conda
tzdata           2024a      h8827d51_1          121.3 KiB  conda  tzdata-2024a-h8827d51_1.conda
xz               5.2.6      h57fd34a_0          230.2 KiB  conda  xz-5.2.6-h57fd34a_0.tar.bz2

Is this user error on my part, or a regression, or something else?

Thank you all so much!

Additional Context

No response

@wolfv
Copy link
Contributor

wolfv commented Sep 20, 2024

Argh, that looks like a bug / regression on first glance. Woudl you be able to whip up a PR with a test case?

@cisaacstern
Copy link
Contributor Author

Thank for the prompt reply, and yes would be happy to. Will get that up shortly.

@cisaacstern
Copy link
Contributor Author

Done in #870. As noted there, the regression is not present for me when running those tests locally (from a fresh build), so maybe the regression is already fixed in main and only present in 0.6.3 release?

@wolfv
Copy link
Contributor

wolfv commented Sep 20, 2024

It's possible that we need to cut a new release of the Python bindings. I kicked off the CI run for your new tests.

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

No branches or pull requests

2 participants