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

pdm update when upgrading from lockfile v4.4.2 differs from pdm lock without existing lockfile #3105

Closed
sigma67 opened this issue Aug 14, 2024 · 3 comments
Labels
🐛 bug Something isn't working

Comments

@sigma67
Copy link
Contributor

sigma67 commented Aug 14, 2024

  • [x ] I have searched the issue tracker and believe that this is not a duplicate.

Make sure you run commands with -v flag before pasting the output.

Steps to reproduce

  • Have a v4.4.2 lockfile in your repo
  • Have latest pdm installed
  • $ pdm update

Actual behavior

Lockfile will now contain strict [metadata.targets] with pinned Python version, which does not work on other developer's machines

prior lockfile:

# This file is @generated by PDM.
# It is not intended for manual editing.

[metadata]
groups = ["default", "dev"]
strategy = ["inherit_metadata"]
lock_version = "4.4.2"
content_hash = "sha256:d33278b3b6db983b32106cf56b5238f9a5e33adf341adb6af9408e06948eebe7"

... pdm update...

# This file is @generated by PDM.
# It is not intended for manual editing.

[metadata]
groups = ["default", "dev"]
strategy = ["inherit_metadata"]
lock_version = "4.5.0"
content_hash = "sha256:d33278b3b6db983b32106cf56b5238f9a5e33adf341adb6af9408e06948eebe7"

[[metadata.targets]]
requires_python = "==3.10.12"
platform = "manylinux_2_35_x86_64"
implementation = "cpython"
gil_disabled = false

^^ none of the auto-defaults being set here are desired.

Expected behavior

Lockfile shall contain loose [metadata.targets] with only requires-python set to the one set in pyproject.toml.

This is also the default behavior of latest pdm when creating a new pdm lockfile.

[[metadata.targets]]
requires_python = ">=3.10"

Environment Information

irrelevant

@sigma67 sigma67 added the 🐛 bug Something isn't working label Aug 14, 2024
@sigma67 sigma67 changed the title pdm update behavior when upgrading from lockfile v4.4.2 differs from pdm lock without existing lockfile pdm update when upgrading from lockfile v4.4.2 differs from pdm lock without existing lockfile Aug 14, 2024
@frostming
Copy link
Collaborator

frostming commented Aug 14, 2024

it's because the 4.4.2 lock file is missing the "cross_platform" strategy,which makes it a strict lock file

@sigma67
Copy link
Contributor Author

sigma67 commented Aug 14, 2024

Thanks, that was helpful for debugging.

So the root issue is this. Multiple users collaborate on a project. One uses pdm 2.16 (A), the other uses 2.17 (B).

B upgrades the lockfile to 4.5.0, removes cross_platform element.
A downgrades again to 4.4.2, now without cross_platform element.
B upgrades to 4.5.0 again, now with undesired strict metadata.targets.

@frostming
Copy link
Collaborator

So the root issue is this. Multiple users collaborate on a project. One uses pdm 2.16 (A), the other uses 2.17 (B).

Yes, we try to make it backward-compatible but not forward, we can't put much effort into forward-compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants