pdm
pdm copied to clipboard
add a `--no-input` options to pdm sync for automation scenario
Is your feature/enhancement proposal related to a problem? Please describe.
Hello. We use PDM a lot in CI and in Docker build with a private PyPI registry, where we often provides credentials with a .netrc file. When there is a problem with this credentials, PDM fails with this very misleading error that confuses all our developers:
17.18 File "/usr/local/lib/python3.11/site-packages/requests/hooks.py", line 30, in dispatch_hook
17.18 _hook_data = hook(hook_data, **kwargs)
17.18 ^^^^^^^^^^^^^^^^^^^^^^^^^
17.18 File "/usr/local/lib/python3.11/site-packages/unearth/auth.py", line 415, in handle_401
17.18 username, password, save = self._prompt_for_password(parsed.netloc)
17.18 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17.18 File "/usr/local/lib/python3.11/site-packages/pdm/models/auth.py", line 54, in _prompt_for_password
17.18 return super()._prompt_for_password(netloc)
17.18 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17.18 File "/usr/local/lib/python3.11/site-packages/unearth/auth.py", line 369, in _prompt_for_password
17.18 username = input(f"User for {netloc}: ")
17.18 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17.18 EOFError: EOF when reading a line
Describe the solution you'd like
We would enjoy an option like apt-get install --yes or poetry --no-interaction to inform PDM that it's not facing an human and thus it is useless to ressort to a prompt, just fail showing the problem. Since Poetry has --no-interaction, this one should be preferred I think.
Cheers
The prompt shows if -v is passed
I don't think the verbose mode should include "showing a prompt in case of missing credentials". In our CI and docker build, we want the verbose mode but not the prompt.
I don't think the verbose mode should include "showing a prompt in case of missing credentials". In our CI and docker build, we want the verbose mode but not the prompt.
True, but the opposite holds: when -v is not passed, prompt can't be shown because the output is hidden behind a spinner. I am afraid adding another --no-interactive would make it confusing.
Isn't it the problem that the spinner prevents a prompt to be shown? I am not sure but I think in other tools, a spinner doesn't prevent a prompt to be shown.
Thank you very much, btw :)