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

False-positive warning when installing/updating with cache enabled #2502

Closed
1 task done
noirbizarre opened this issue Dec 17, 2023 · 0 comments · Fixed by #2503 or j178/pdm#1
Closed
1 task done

False-positive warning when installing/updating with cache enabled #2502

noirbizarre opened this issue Dec 17, 2023 · 0 comments · Fixed by #2503 or j178/pdm#1
Labels
🐛 bug Something isn't working

Comments

@noirbizarre
Copy link
Member

noirbizarre commented Dec 17, 2023

  • 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

  • Create a new PDM project
  • Add any dependency to the n-1 version (eg. pytest==7.4.2)
  • Lock & install
  • Update dependency to the last version (eg. pytest==7.4.3)
  • Lock & install

Actual behavior

Since #2359 PDM emit one warning by file or directory in each dependency he manages and update if caching is enabled.

$ pdm init -n    
Creating a pyproject.toml for PDM...
Virtualenv is created successfully at /tmp/demo/.venv
Project is initialized successfully

$ pdm add 'pytest==7.4.2'
Adding packages to default dependencies: pytest==7.4.2
🔒 Lock successful
Changes are written to pyproject.toml.
Synchronizing working set with resolved packages: 4 to add, 0 to update, 0 to remove

  ✔ Install iniconfig 2.0.0 successful
  ✔ Install pytest 7.4.2 successful
  ✔ Install packaging 23.2 successful
  ✔ Install pluggy 1.3.0 successful

🎉 All complete!

$ sed -i 's/7.4.2/7.4.3/' pyproject.toml

$ pdm install 

WARNING: Lockfile hash doesn't match pyproject.toml, packages may be outdated
Updating the lock file...
🔒 Lock successful
Changes are written to pdm.lock.
Synchronizing working set with resolved packages: 0 to add, 1 to update, 0 to remove

/home/noirbizarre/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/installers/installers.py:179: PDMWarning: Overwriting existing package: /tmp/demo/.venv/lib/python3.11/site-packages/_pytest
  for relpath in _create_links_recursively(
/home/noirbizarre/.local/pipx/venvs/pdm/lib/python3.11/site-packages/pdm/installers/installers.py:179: PDMWarning: Overwriting existing package: /tmp/demo/.venv/lib/python3.11/site-packages/pytest
  for relpath in _create_links_recursively(
  ✔ Update pytest 7.4.2 -> 7.4.3 successful

🎉 All complete!

Expected behavior

PDM only emit warning when replacing a flat dependency (file or directory) and is silent when replacing its own symlinks (it will still warn on the first time you install after enabling the cache)

$ pdm init -n    
Creating a pyproject.toml for PDM...
Virtualenv is created successfully at /tmp/demo/.venv
Project is initialized successfully

$ pdm add 'pytest==7.4.2'
Adding packages to default dependencies: pytest==7.4.2
🔒 Lock successful
Changes are written to pyproject.toml.
Synchronizing working set with resolved packages: 4 to add, 0 to update, 0 to remove

  ✔ Install iniconfig 2.0.0 successful
  ✔ Install pytest 7.4.2 successful
  ✔ Install packaging 23.2 successful
  ✔ Install pluggy 1.3.0 successful

🎉 All complete!

$ sed -i 's/7.4.2/7.4.3/' pyproject.toml

$ pdm install 

WARNING: Lockfile hash doesn't match pyproject.toml, packages may be outdated
Updating the lock file...
🔒 Lock successful
Changes are written to pdm.lock.
Synchronizing working set with resolved packages: 0 to add, 1 to update, 0 to remove

  ✔ Update pytest 7.4.2 -> 7.4.3 successful

🎉 All complete!

Environment Information

PDM version:
  2.11.1
Python Interpreter:
  /tmp/demo/.venv/bin/python (3.11)
Project Root:
  /tmp/demo
Local Packages:
  
{
  "implementation_name": "cpython",
  "implementation_version": "3.11.6",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "6.6.6-arch1-1",
  "platform_system": "Linux",
  "platform_version": "#1 SMP PREEMPT_DYNAMIC Mon, 11 Dec 2023 11:48:23 +0000",
  "python_full_version": "3.11.6",
  "platform_python_implementation": "CPython",
  "python_version": "3.11",
  "sys_platform": "linux"
}
@noirbizarre noirbizarre added the 🐛 bug Something isn't working label Dec 17, 2023
noirbizarre added a commit to noirbizarre/pdm that referenced this issue Dec 17, 2023
noirbizarre added a commit to noirbizarre/pdm that referenced this issue Dec 17, 2023
frostming pushed a commit that referenced this issue Dec 18, 2023
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
1 participant