-
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
Update the lock file without upgrading dependencies #1614
Comments
Hello @cjolowicz , have you tried running Which version of poetry do you use? fin swimmer |
Hi @finswimmer, thanks for your reply! I just reproduced this with Poetry 1.0.0b6. Originally I was on 1.0.0b4 when filing this issue. To reproduce, clone my repository and check out I don't understand how running If I run |
I just found a way to "trick" Poetry into doing this: Invoke Update: A better workaround is provided below by @seansfkelley, see #1614 (comment). For some bikeshedding, I generally use this with insecure-package, a dependency unlikely to appear in any project. poetry add insecure-package && poetry remove insecure-package |
Sorry, it was my misunderstanding about what AFAIK at the moment there is no way to sync between Maybe two ways to go at the moment:
or
|
The trick by @cjolowicz to run However, on some cases, it loses markers and extras of dependencies that were not "updated". One option is to pass all those dependencies in the same |
In #496 (comment) there is also outlined an alternate workaround: I use this workaround all the time. Updating metadata in the lockfiles, resolving merge conflicts, etc. All of these operations get me into a state where I want something like |
This functionality is much needed imo. A single package addition/update shouldn't trigger a dependency graph resolution for all the dependencies of the project. I'd rather |
I've been hitting this issue myself as we roll poetry out to a project with many developers in a relatively heterogeneous development environment. We are finding a lot of merge conflicts, particularly when dealing with dependency changes in a release/CI flow where merge conflicts can be a real frustration. I've been trying to think through what a
I may try to take a stab at a PR adding such a feature, but would love to hear more feedback on what |
Fully in favor of this, however, the reason I suggested By analogy,
I don't think this makes sense. The lockfile's job is to be the source of truth for what dependencies should be installed, if you noodled your virtualenv with This reminds me of a similar question though, which is how stringent should |
Oh right, yeah that makes sense. Thanks for chiming in! (On a side note, I don't suppose there are any critical situations where someone would prefer more changes to dependency versions, it's usually the other way around, so if it were up to me I might not consider it a breaking change and be less conservative than wait for v2.0. I'm not a huge fan of semver anyway, changing a number should not absolve developers of design sins nor allow backwards compatibility related misdeeds but I digress...) |
How to use it? |
@earshinov yes, but it is bot yet available in a released version. |
If you're on poetry 1.0 (tested with poetry 1.0.10) You can also skip the Assume you already have a pyproject.toml. Skip Example:
Your Without this, the default behavior betrays the premise of lockfiles - keeping sub-dependencies steady unless you ask for it. |
The pyproject.toml and the poetry.lock files were out of sync, so to resolve them, I did a `poetry lock --no-update`. This added the `yaffshiv` package to the lock file, which was missing and causing the out-of-sync behavior. For some magic reason, it also updated the `coverage` from 6.2 to 6.3, resulting the minimum python package increase from 3.6 to 3.7. python-poetry/poetry#1614
Getting some weird SolverProblemError failures related to sshtunnel ^0.4.0 , Possibly related to python-poetry/poetry#1614 : ``` Creating virtualenv couchbase-cluster-admin-Zcl4Ty5o-py3.8 in /home/runner/.cache/pypoetry/virtualenvs Installing dependencies from lock file Warning: The lock file is not up to date with the latest changes in pyproject.toml. You may be getting outdated dependencies. Run update to update them. SolverProblemError Because couchbase-cluster-admin depends on sshtunnel (^0.4.0) which doesn't match any versions, version solving failed. at /opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/poetry/puzzle/solver.py:241 in _solve 237│ packages = result.packages 238│ except OverrideNeeded as e: 239│ return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest) 240│ except SolveFailure as e: → 241│ raise SolverProblemError(e) 242│ 243│ results = dict( 244│ depth_first_search( 245│ PackageNode(self._package, packages), aggregate_package_nodes Error: Process completed with exit code 1. ```
Getting some weird SolverProblemError failures related to sshtunnel ^0.4.0 , Possibly related to python-poetry/poetry#1614 : ``` Creating virtualenv couchbase-cluster-admin-Zcl4Ty5o-py3.8 in /home/runner/.cache/pypoetry/virtualenvs Installing dependencies from lock file Warning: The lock file is not up to date with the latest changes in pyproject.toml. You may be getting outdated dependencies. Run update to update them. SolverProblemError Because couchbase-cluster-admin depends on sshtunnel (^0.4.0) which doesn't match any versions, version solving failed. at /opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/poetry/puzzle/solver.py:241 in _solve 237│ packages = result.packages 238│ except OverrideNeeded as e: 239│ return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest) 240│ except SolveFailure as e: → 241│ raise SolverProblemError(e) 242│ 243│ results = dict( 244│ depth_first_search( 245│ PackageNode(self._package, packages), aggregate_package_nodes Error: Process completed with exit code 1. ```
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. |
Feature Request
Please provide a way to update the lock file without upgrading dependencies.
After adding a
[tool.poetry.extras]
section to pyproject.toml, Poetry displays the following warning, for example on install:That's fine, but if I run
poetry update
it upgrades my dependencies, which is not what I want at this time. If I runpoetry lock
instead, it still upgrades dependencies. Am I missing something?Here are the relevant files and the commit:
Sorry for not providing a smaller reproducible example, it's quite tricky to generate a poetry.lock file with outdated dependencies.
The text was updated successfully, but these errors were encountered: