-
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 does not pull latest commit from branch #6046
Comments
If you remove the The latest from |
It would defeat the point of a lockfile if it didn't actually lock. Docs MR clarifying that this is deliberate sounds like the way to go. |
There are some instances (CI and dev) where it would be useful to be able use a branch and not pin to a specific revision. For release pinning makes sense. I can work around the above behavior. But it would make poetry more adaptable to make this pinning optional. |
Also, we use |
'adaptable' is not the goal: the purpose of the lockfile is to lock your dependencies. If you want to update them, that's what 'poetry update' is for. |
If this turns into a docs issue, this is what we have to do in CI to work around:
This seems super hacky, and if poetry followed what the docs appear to say I could just updated to main branch after each release, and on release pin to a tag, or use an artifact. There are other undesirable behaviors that happen, that we have to fix like remapping absolute path specified in the pyproject.toml for artifact install from relative path back to absolute, but that is a different issue. |
does not specify whether this assumption is made at lock time (which is actually the case) or at install time (which you wish for). So I agree that there's room for improvement there, but I don't agree that the behaviour and the docs are actually different.
simply |
I appreciate the purpose of a lock file. However when you have projects that depend on projects and are developing in a tiered fashion, some deps can be useful to have them unlocked during development and locked during release. |
fyi #3875 fixed this: poetry used to do what you would like it to do but that was considered to be a bug |
Yeah I'm not sure it's exactly my issue, in that issue the lock file was updated but not the src where git dependencies had been cloned. I.E. I'm suggesting a way to allow the latest to be pulled when calling I guess we could just delete the lock file between releases, which will be recreated with the latest on each |
pretty clear that what you are asking for was an unintended side effect, deliberately fixed. |
Actually I'm suggesting it does not put a resolved_ref in poetry.lock under certain circumstances and then updated to the latest based on that poetry.lock file. This bug was about updating only the poetry.lock and then not updating the src at all. Read the bug: |
pretty sure this just isn't going to happen and you're better off looking for a workflow that works for you with poetry as it is - or perhaps not using poetry at all. You "appreciate the purpose of a lockfile" but are literally asking for it not to work as a lockfile. I'm sure a docs MR clarifying poetry behaviour would be welcome. |
Is the poetry community open to discussing issues users have or new features that allows others to use poetry in their particular env or use-case? I was following another bug about paths for installed artifacts and the community didn't seem to care that, despite the fact an absolute path is used in the pyproject.toml, poetry writes a relative path to the poetry.lock. This assumes the project installation from the exact same place each time. In many circumstances this will fail. But there was pushback on fixing it despite multiple people saying it was an issue in CI. poetry frankly has the ability to do both, just like what I'm asking here. |
"you're better off.. perhaps not using poetry at all" Wow. OK. |
I simply mean that you should use the right tool for the job. Poetry is a tool, among other things, for locking dependencies and giving repeatable builds. If that's not what you want, then perhaps it's not the right tool for you. I don't speak for "the poetry community", only for myself. I don't know anything about that other conversation. Feel free to submit an MR, others may take a different view. I wouldn't expect so, but I've been wrong before! |
I'm going to close this issue as wont-fix since it seems to be getting a bit heated -- it's always been Poetry's explicit intention to provide reproducible installs. I don't think an explicit Likewise, a docs PR clarifying any deficiency in explaining expected behavior would also be welcome. |
I am on the latest Poetry version.
I have searched the issues of this repo and believe that this is not a duplicate.
If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).OS version and name: Ubuntu 20.04.4 LTS (Focal Fossa)
Poetry version: 1.14
pyproject.toml file:
Issue
According to the docs a project can get the latest commit from a branch using the
requests = { git = "https://github.com/kennethreitz/requests.git", branch = "next" }
dependency specification.However when using this specification, poetry pins the dependency to a specific commit hash. The poetry.lock after
poetry update
using the above pyproject.toml dependency declaration:The expectation based on the docs (see below) is that using a branch would pull the latest from that branch on each install unless a
rev
ortag
is specified, however what poetry does is pull the latest at the time of update and then pin to thatrev
usingresolved_reference = <commit hash>
. Either the documentation needs to be clearer about pinning to the version at the time ofpoetry update
or there is a bug in how poetry is handling thegit
dependency specification. If the docs need to be updated because this is intended behavior perhaps this could be a feature request:rev
ortag
specified also, or some flag is used to tell poetry to not pin to a specificrev
If this is a feature that sounds reasonable for poetry, I would be happy to submit a PR with the needed functionality. If this is a bug or docs issues, I would be happy to submit a PR with the needed fix.
See docs https://python-poetry.org/docs/dependency-specification/#git-dependencies, reproduced below:
"To depend on a library located in a git repository, the minimum information you need to specify is the location of the repository with the git key:
Since we haven’t specified any other information, Poetry assumes that we intend to use the latest commit on the master branch to build our project.
You can combine the git key with the branch key to use another branch. Alternatively, use rev or tag to pin a dependency to a specific commit hash or tagged ref"
The text was updated successfully, but these errors were encountered: