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 lock --update-reuse expands the $PROJECT_ROOT variable when extra dependencies are included #2852

Closed
1 task done
jakubman1 opened this issue Apr 26, 2024 · 0 comments · Fixed by #2874
Closed
1 task done
Assignees
Labels
🐛 bug Something isn't working

Comments

@jakubman1
Copy link

  • 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

Suppose you have a local library and a main app in a monorepo as such:

my-repo
- app
-- pyproject.toml
-- pdm.lock
-- myapp/
- lib
-- pyproject.toml
-- pdm.lock
-- lib/

The app has the library listed as a dependency with extra dependencies using the $PROJECT_ROOT variable as: "lib[test] @ file:///${PROJECT_ROOT}/../lib"
Try calling pdm lock, then pdm lock --update-reuse for the app, observe the library in the app pdm.lock file.

Actual behavior

After calling pdm lock, the pdm.lock file contains the following section:

[[package]]
name = "lib"
version = "0.1.0"
extras = ["test"]
requires_python = ">=3.8"
path = "../lib"
summary = "Library"
groups = ["default"]
dependencies = [
    "lib @ file:///${PROJECT_ROOT}/../lib",
    "pytest",
]

When calling pdm lock --update-reuse, the PROJECT_ROOT variable gets expanded to the actual path:

[[package]]
name = "lib"
version = "0.1.0"
extras = ["test"]
requires_python = ">=3.8"
path = "../lib"
summary = "Library"
groups = ["default"]
dependencies = [
    "lib @ file:///mnt/c/pdm-minimal/lib",
    "pytest",
]

Expected behavior

The pdm.lock file should be the same when calling pdm lock and then pdm lock --update-reuse immediately after, the PROJECT_ROOT variable should not get expanded.

Environment Information

# Paste the output of `pdm info && pdm info --env` below:
PDM version:
  2.15.0
Python Interpreter:
  /mnt/c/pdm-minimal/app/.venv/bin/python (3.8)
Project Root:
  /mnt/c/pdm-minimal/app
Local Packages:

{
  "implementation_name": "cpython",
  "implementation_version": "3.8.10",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "5.15.146.1-microsoft-standard-WSL2",
  "platform_system": "Linux",
  "platform_version": "#1 SMP Thu Jan 11 04:09:03 UTC 2024",
  "python_full_version": "3.8.10",
  "platform_python_implementation": "CPython",
  "python_version": "3.8",
  "sys_platform": "linux"
}
@jakubman1 jakubman1 added the 🐛 bug Something isn't working label Apr 26, 2024
@frostming frostming self-assigned this May 8, 2024
frostming added a commit that referenced this issue May 8, 2024
…extra dependencies are included

Fixes #2852

Signed-off-by: Frost Ming <me@frostming.com>
frostming added a commit that referenced this issue May 8, 2024
…extra dependencies are included (#2874)

Fixes #2852

Signed-off-by: Frost Ming <me@frostming.com>
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
2 participants