-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
poetry update
with git-based dependencies updates poetry.lock
but not the virtual environment
#3958
Comments
I have a proposed fix for this in #3867, poetry is not detecting it is a git installation properly. |
The fix put in for #3867 doesn't seem to be working for many, and isn't working for me either, but the issue has been closed. So Hopefully this open issue will get some traction? |
Any updates? |
I can confirm the fix in #3867 works for me (git However, the latest poetry release does not include the fix yet ( If you are willing to try a poetry pre-release:poetry self update --preview Note that poetry.lock files created by the 1.2 preview may be incompatible with those of the stable versions. If you want the fix as a hotfix to poetry 1.1.x:# Extract the venv path from this file (second line):
cat `which poetry`
# Add the hotfix to this file. For me, it needed to go into line 68.
nano <VENV>/lib/python3.8/site-packages/poetry/repositories/installed_repository.py The hotfix, for quick reference (credit to @wakemaster39): # this is required to handle pathlib oddity on win32 python==3.5
path = lib.joinpath(path)
paths.add(path)
src_path = env.path / "src" / name
if not paths and src_path.exists():
paths.add(src_path)
return paths
@classmethod |
The 1.2 preview crashes for me, but this hotfix works perfectly on |
The workaround that @Ivorforce worked for me but I was using the legacy installer and the file to patch is at |
This is still happening to me on 1.1.12. How can we move this forward? I tried @Ivorforce workaround but it's not perfect, since all git dependencies are cloned even if the version has not changed: Check these results:
It worked! But I only expected to update dj-stripe. And from the results it was indeed the only one that updated the version. But what happens if I run it again?
What? So all git dependencies are updated even if the version didn't change 🤔 |
as a quick workaround
|
Is there an update on this issue? |
I can confirm this issue is still present. Is there anything I can do to help document its reproducibility and/or help with implementing a fix? |
Same here. I've organized a workaround into a simple bash script. Maybe it will help somebody. # poetry-reinstall.sh
#!/bin/bash
uri=${1?"URI is required"}
shift
type=${uri%+*}
type_uri=${uri#*+}
case $type in
git)
git_uri=${type_uri##.git*}
git_name_with_ref=${git_uri##*/}
git_name=${git_name_with_ref#@*}
name=${git_name%.git*}
poetry remove ${name} && poetry lock && poetry add ${@} ${uri}
;;
*)
echo "unsupported type ${type}"
exit 1
;;
esac Usage # install dependency at first time
$ poetry add git+ssh://[email protected]/zerlok/asynchron.git@main
# reinstall dependency after update in the main branch
$ bash poetry-reinstall.sh git+ssh://[email protected]/zerlok/asynchron.git@main |
Works fine with poetry 1.1.13: msgpack = { git = "https://github.com/msgpack/msgpack-python", rev = "v1.0.3" } after installing:
bump the
This can be closed |
Does not work out of the box for me with poetry 1.1.13. However, here is a hacked together recipe that uses dasel to parse # Update Poetry git dependency
poetry_reinstall_git LIB:
#!/usr/bin/env bash
uri=$(dasel select -f pyproject.toml -s '.tool.poetry.dependencies.{{LIB}}.git')
rev=$(dasel select -f pyproject.toml -s '.tool.poetry.dependencies.{{LIB}}.rev')
poetry remove {{LIB}} && poetry lock && poetry add "git+$uri@$rev" |
It looks to work on 1.1.3 when there's been a package version change. |
This should be solved in the latest Poetry version (1.2.2). Feel free to leave a comment if you disagree. |
I still experience this on 1.6.1. |
@truenicoco I don't see this behavior with 1.6.1. My venv gets updated as expected. I'm on macOS/zsh and I've installed poetry with pipx (python 3.11). Maybe check the output of |
Nothing suspicious here. Other deps get without trouble, it's just that specific git dependency that, despite the |
Can you provide the full logs from when you do this update? poetry update <pkg> -vvv |
Not the exact same repo because I did the And I could reproduce the bug, despite what the end of the log states, |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
-vvv
option).Issue
Almost identical to #2921 with only one difference, I have a git dependency that is defined with a revision instead of branch. When I change
rev="v0.1.2"
torev="v0.1.3"
poetry.lock
successfully updated with the correct commitresolved_reference
but the library in the virtual environment remains checked-out at the commit that was latest whenpoetry install
was last run.The text was updated successfully, but these errors were encountered: