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

add a --no-input options to pdm sync for automation scenario #2934

Closed
deronnax opened this issue Jun 11, 2024 · 5 comments · Fixed by #3030
Closed

add a --no-input options to pdm sync for automation scenario #2934

deronnax opened this issue Jun 11, 2024 · 5 comments · Fixed by #3030
Assignees
Labels
⭐ enhancement Improvements for existing features

Comments

@deronnax
Copy link
Contributor

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

@deronnax deronnax added the ⭐ enhancement Improvements for existing features label Jun 11, 2024
@frostming
Copy link
Collaborator

The prompt shows if -v is passed

@deronnax
Copy link
Contributor Author

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.

@frostming
Copy link
Collaborator

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.

@deronnax
Copy link
Contributor Author

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.

@frostming frostming self-assigned this Jul 18, 2024
frostming added a commit that referenced this issue Jul 18, 2024
frostming added a commit that referenced this issue Jul 18, 2024
@deronnax
Copy link
Contributor Author

Thank you very much, btw :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⭐ enhancement Improvements for existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants