[Python] How to get uv to git pull dependencies on uv sync?

Discussão em 'Python' iniciado por Stack, Fevereiro 11, 2025.

  1. Stack

    Stack Membro Participativo

    In uv, I want to add a git repository as a dependency which is easy in itself, but if we commit in the git repository of the dependency I want uv sync to do a git pull for this git repo. Basically do a git pull on the dependency git repo and then apply the changed code for the dependency to my current virtual env.

    Here is what I tried:

    uv add git+https://github.com/PowerInsight/quantstats.git


    Then I make a commit on https://github.com/PowerInsight/quantstats.git in a python file. Then I run this in the repo that reference https://github.com/PowerInsight/quantstats.git

    uv sync


    The file I changed in the git repo never gets updated in my .venv folder for the referenced dependency: .venv\Lib\site-packages\quantstats

    Then tried the same thing with a specific branch:

    uv add git+https://github.com/PowerInsight/quantstats.git --branch main


    Same problem, it does not get updated on commit.

    Then I tried adding this to both the pyproject.toml of my main project and the dependency git repo:

    [tool.uv]
    cache-keys = [{ git = { commit = true } }]


    I also tried setting this package to always get re-installed:

    [tool.uv]
    reinstall-package = ["quantstats"]


    What do I need to do for uv to pull from the git repository dependency on any commit?

    Continue reading...

Compartilhe esta Página