prefix-dev / pixi

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

Using a specific branch from git dependency #1206

Open niemiaszek opened 5 months ago

niemiaszek commented 5 months ago

Problem description

I wanted to finally drop some ugly pip postinstalls and use git dependency. I wanted to install some hotfixed branch of git repository, but I met some unexpected behavior (at least for me)

ffmpeg-python = {git= "https://github.com/charlienewey/ffmpeg-python.git", branch = "bugfix/782"}

This resulted in using last commit from main branch anyway, even tho I specified the "bugfix/782" branch. To get exactly what I wanted I had to pass concrete commit sha.

ffmpeg-python = {git= "https://github.com/charlienewey/ffmpeg-python.git", branch = "bugfix/782", rev="37dd98ca210fb8132575bedd719c6f8f9bfd1021"}

My question is whether it is intended behavior? I couldn't find "branch" option for git dependencies described in docs yet. It would be more convenient if passing branch resulted in using the most recent commit.

ruben-arts commented 5 months ago

The hard problem with this is the decision when we update the lockfile.

If you would always want to check if there is a new commit on that branch it would be slow to run pixi commands as pixi run also updates environments.

An pixi update command would fix it and would make the logic more like cargo.

niemiaszek commented 5 months ago

Right, was just a bit surprised that still installed main head instead of what would happen with git checkout bugfix/782. Probably one more line in docs would've made it clear, but I can expect it is rarely used feature yet.

pixi update would be crazy for sure, good luck and thanks for recent updates :)

blooop commented 1 week ago

I was hit by a simliar issue today when trying to add a dependency on a git branch.

dependencies = ["moviepy@git+https://github.com/blooop/moviepy.git@feature/decorator_update"]

output error:

  × Unsupported pep508 requirement: 'moviepy @ git+https://github.com/blooop/
  │ moviepy.git@feature/decorator_update'
  ╰─▶ Found invalid characters for git revision 'feature/decorator_update', branches and
      tags are not supported yet
niemiaszek commented 1 week ago

@blooop unfortunately for now you can only use rev tag. So it's limited to using only specific commit now.

pixi update command has been added already, but I'm not sure if current implementation is enough to make using branches or tags easy.

tdejager commented 1 week ago

We should give this a look again relatively soon, as I think with the latest uv upgrades this has probably become a lot easier as well.

blooop commented 1 week ago

Thanks. I have found a workaround for the moment, and its good to know its likely to be fixed in the future.