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

--dry-run option of pdm add still creates pdm.lock and empty __pypackages__ #918

Closed
1 task done
astrojuanlu opened this issue Feb 16, 2022 · 1 comment
Closed
1 task done
Labels
🐛 bug Something isn't working

Comments

@astrojuanlu
Copy link

astrojuanlu commented Feb 16, 2022

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

The pdm add command advertises a --dry-run option saying

  --dry-run             Show the difference only and don't perform any action

however, passing it seems to still create a pdm.lock file and an empty __pypackages__ directory.

Steps to reproduce

mkdir /src && cd /src
ls -la
python3.9 -m venv .venv    
source .venv/bin/activate    
pip install pdm &> /dev/null          
pdm init -n        
pdm add -vv --dry-run "urllib3==1.25.7"    

Actual behavior

As you can see, pdm add -vv --dry-run "urllib3==1.25.7" adds a pdm.lock and __pypackages__, which I didn't expect.

$ docker run -it --rm python:3.9 bash
root@5a286c804de3:/# mkdir /src && cd /src
root@5a286c804de3:/src# ls -la
total 8
drwxr-xr-x 2 root root 4096 Feb 16 14:05 .
drwxr-xr-x 1 root root 4096 Feb 16 14:05 ..
root@5a286c804de3:/src# python3.9 -m venv .venv    
source .venv/bin/activate    
pip install pdm &> /dev/null          
pdm init -n        
Creating a pyproject.toml for PDM...
Using Python interpreter: /src/.venv/bin/python3.9 (3.9)
Changes are written to pyproject.toml.
(.venv) root@5a286c804de3:/src# ls -la
total 20
drwxr-xr-x 3 root root 4096 Feb 16 14:05 .
drwxr-xr-x 1 root root 4096 Feb 16 14:05 ..
-rw-r--r-- 1 root root   43 Feb 16 14:05 .pdm.toml
drwxr-xr-x 5 root root 4096 Feb 16 14:05 .venv
-rw-r--r-- 1 root root  286 Feb 16 14:05 pyproject.toml
(.venv) root@5a286c804de3:/src# pdm add -vv --dry-run "urllib3==1.25.7"    
Adding packages to default dependencies: urllib3
======== Start resolving requirements ========
  urllib3==1.25.7
  python>=3.9
  Adding requirement urllib3==1.25.7
	Found matching candidates:
	  <Candidate urllib3 1.25.7 from https://pypi.org/simple/urllib3/>
  Adding requirement python>=3.9
======== Starting round 0 ========
Resolving: new pin python >=3.9
======== Ending round 0 ========
======== Starting round 1 ========
Resolving: new pin urllib3 1.25.7
======== Ending round 1 ========
======== Starting round 2 ========
======== Resolution Result ========
Stable pins:
   python None
  urllib3 1.25.7
	Found matching candidates:
	  <Candidate urllib3 1.25.7 from https://pypi.org/simple/urllib3/>
🔒 Lock successful
Packages to add:
  - urllib3 1.25.7
(.venv) root@5a286c804de3:/src# ls -la
total 28
drwxr-xr-x 4 root root 4096 Feb 16 14:06 .
drwxr-xr-x 1 root root 4096 Feb 16 14:05 ..
-rw-r--r-- 1 root root   43 Feb 16 14:05 .pdm.toml
drwxr-xr-x 5 root root 4096 Feb 16 14:05 .venv
drwxr-xr-x 3 root root 4096 Feb 16 14:06 __pypackages__
-rw-r--r-- 1 root root  614 Feb 16 14:06 pdm.lock
-rw-r--r-- 1 root root  286 Feb 16 14:05 pyproject.toml

Expected behavior

--dry-run only shows output on the terminal, but doesn't do anything else (no new files, no new directories).

Environment Information

# pdm info && pdm info --env
PDM version:        1.12.8
Python Interpreter: /src/.venv/bin/python3.9 (3.9)
Project Root:       /src
Project Packages:   /src/__pypackages__/3.9
{
  "implementation_name": "cpython",
  "implementation_version": "3.9.10",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "5.13.0-28-generic",
  "platform_system": "Linux",
  "platform_version": "#31~20.04.1-Ubuntu SMP Wed Jan 19 14:08:10 UTC 2022",
  "python_full_version": "3.9.10",
  "platform_python_implementation": "CPython",
  "python_version": "3.9",
  "sys_platform": "linux"
}
@astrojuanlu astrojuanlu added the 🐛 bug Something isn't working label Feb 16, 2022
@astrojuanlu

This comment was marked as resolved.

@astrojuanlu astrojuanlu changed the title --dry-run option of pdm add has no effect --dry-run option of pdm add still creates pdm.lock and empty __pypackages__ Feb 16, 2022
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

1 participant