Skip to content

pdm 2.25: adding a dependency duplicates lockfile dependencies entries #3542

@sigma67

Description

@sigma67

Describe the bug

pdm add modifies unrelated dependencies in lockfile with pdm >= 2.25.

To reproduce

Minimal reproduction

[dependency-groups]
lint = [
    "mypy[install-types]>=1.13.0",
]

Running pdm install will yield this lockfile entry for mypy:

[[package]]
name = "mypy"
version = "1.16.0"
extras = ["install-types"]
requires_python = ">=3.9"
summary = "Optional static typing for Python"
groups = ["lint"]
dependencies = [
    "mypy==1.16.0",
    "pip",
]

Running pdm add pycowsay will modify the existing lockfile entry to this:

[[package]]
name = "mypy"
version = "1.16.0"
extras = ["install-types"]
requires_python = ">=3.9"
summary = "Optional static typing for Python"
groups = ["lint"]
dependencies = [
    "mypy==1.16.0",
    "mypy==1.16.0",
    "pip",
]
...

So for some reason it duplicates the mypy version pin.

You can repeat this and it will add an additional pin entry every time.

Expected Behavior

No modification of unrelated dependencies.

Environment Information

PDM version:
  2.25.0
Python Interpreter:
  /home/benedikt/PycharmProjects/pes-pip-python3-module/.venv/bin/python (3.10)
Project Root:
  /home/benedikt/PycharmProjects/pes-pip-python3-module
Local Packages:
  
{
  "implementation_name": "cpython",
  "implementation_version": "3.10.12",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "6.8.0-52-generic",
  "platform_system": "Linux",
  "platform_version": "#53~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Jan 15 19:18:46 UTC 2",
  "python_full_version": "3.10.12",
  "platform_python_implementation": "CPython",
  "python_version": "3.10",
  "sys_platform": "linux"
}

Verbose Command Output

No response

Additional Context

No response

Are you willing to submit a PR to fix this bug?

  • Yes, I would like to submit a PR.

Metadata

Metadata

Assignees

Labels

🐛 bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions