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

poetry update doesn't update git dependencies that specify branch but not revision #10025

Open
triopter opened this issue Jan 12, 2025 · 6 comments
Labels
status/waiting-on-response Waiting on response from author

Comments

@triopter
Copy link

The workaround suggested in #6046 (comment)_ is to run poetry update. But if you've specified a branch for your git repo, poetry update <dependency_name> doesn't update the resolved_reference commit specification.

So imagine a pyproject.toml with the following:

[tool.poetry.dependencies]
# ...
my_dep = { git = "git@github.com:whatever/my-dep.git", develop = true, branch="main" }
# ...

And say the HEAD of the main branch is commit abcd1234.... After poetry install, poetry.lock will contain something like:

[[package]]
name = "my_dep"
version = "0.1"
optional = false
python-versions = "*"
files = []
develop = true

[package.dependencies]
# ...

[package.source]
type = "git"
url = "git@github.com:whatever/my-dep.git"
reference = "main"
resolved_reference = "abcd1234..."

Now I make another commit on main and push to github. Now the HEAD of the main branch is commit 9876fedc...

The expected behavior is that poetry update my_dep will update poetry.lock to look like this:

[[package]]
name = "my_dep"
version = "0.1"
optional = false
python-versions = "*"
files = []
develop = true

[package.dependencies]
# ...

[package.source]
type = "git"
url = "git@github.com:whatever/my-dep.git"
reference = "main"
resolved_reference = "9876fedc..."

The actual behavior is that poetry.lock is unchanged, still containing:

resolved_reference = "abcd1234..."

Obviously we don't want poetry install to entirely ignore the resolved_reference, which is the bug fixed in #2921, to my understanding. But it should still be possible to update the locked commit in resolved_reference when explicitly requested.

@dimbleby
Copy link
Contributor

poetry already behaves exactly as you ask

if you think otherwise please provide a way to reproduce

@triopter
Copy link
Author

triopter commented Jan 12, 2025

Well, I've been running poetry update <my_dependency> --no-cache over and over today on a repo that's got a dependency specified exactly as above, and the resolved_reference remains stuck on an older commit despite the repo on github having a different, newer commit hash as the HEAD of main. I thought the steps above were sufficient to reproduce.

@finswimmer
Copy link
Member

Which version of Poetry are you using?

@triopter
Copy link
Author

Poetry 1.8.5. Python 3.13.1. On MacOS 13.7.1 (Intel) if it matters.

Fwiw, I ended up deleting the resolved_reference from the lockfile just to get unstuck; and after a subsequent poetry update it hasn't been restored at all. So not sure what's going on there.

@dimbleby
Copy link
Contributor

I thought the steps above were sufficient to reproduce.

They are not.

Suggest provide eg a docker image or an example repository.

And of course you should use the latest release, if it turns out this is something that is recently fixed then none of us should want to spend time on that.

@finswimmer
Copy link
Member

Until now I wasn't able to reproduce this. So there is a good chance it's a problem on your end. Make sure new commits are really pushed to the remote branch.

@finswimmer finswimmer added the status/waiting-on-response Waiting on response from author label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/waiting-on-response Waiting on response from author
Projects
None yet
Development

No branches or pull requests

3 participants