prefix-dev / pixi

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

pixi doesn't install specified commit of pypi git dependency #2456

Open beenje opened 3 days ago

beenje commented 3 days ago

Checks

Reproducible example

This is with pixi 0.35.0.

Considering the following pixi.toml:

[project]
channels = ["conda-forge"]
name = "test-pixi"
platforms = ["osx-arm64", "linux-64"]

[tasks]
check = "grep orphan .pixi/envs/default/lib/python3.12/site-packages/sphinx_tags/__init__.py"

[dependencies]
python = "3.12.*"
pip = ">=24.3.1,<25"
sphinx = "*"

[pypi-dependencies]
# sphinx-tags = { git = "https://github.com/beenje/sphinx-tags.git", rev = "490f40f" }
sphinx-tags = "==0.4"

If I run pixi run check, I get the expected output (only one line with orphan).

$ pixi run check
✨ Pixi task (check): grep orphan .pixi/envs/default/lib/python3.12/site-packages/sphinx_tags/__init__.py
        content.append(":orphan:")

I now replace the sphinx-tags version with a specific commit (the line orphan: true was added in this commit).

[pypi-dependencies]
sphinx-tags = { git = "https://github.com/beenje/sphinx-tags.git", rev = "490f40f" }
$ rm -rf .pixi/ pixi.lock
$ pixi run check
✨ Pixi task (check): grep orphan .pixi/envs/default/lib/python3.12/site-packages/sphinx_tags/__init__.py
        content.append(":orphan:")

The old version is still installed despite the proper version in pixi.lock:

$ grep sphinx-tags pixi.lock
      - pypi: git+https://github.com/beenje/sphinx-tags.git@490f40f0042792ca410c249e195f29c96e33b25b
      - pypi: git+https://github.com/beenje/sphinx-tags.git@490f40f0042792ca410c249e195f29c96e33b25b
  name: sphinx-tags
  url: git+https://github.com/beenje/sphinx-tags.git@490f40f0042792ca410c249e195f29c96e33b25b

If I remove rattler cache, I get the proper version installed:

$ rm -rf .pixi /root/.cache/rattler/cache
$ pixi run check
✨ Pixi task (check): grep orphan .pixi/envs/default/lib/python3.12/site-packages/sphinx_tags/__init__.py
        content.append("orphan: true")
        content.append(":orphan:")

Issue description

I believe the issue is the same as what was reported in https://github.com/prefix-dev/pixi/issues/2358, but closed by the author who couldn't reproduce.

There seems to be a cache issue preventing the specified git version to be installed, when another version was installed previously.

Expected behavior

Removing the cache shouldn't be needed to install a specific git version of a package.

ruben-arts commented 3 days ago

Thank you for this great reproducer. It even works on my windows machine. We do need to look into this. It also doesn't work with an earlier version.