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 ignores PDM_PYPI_USERNAME and PDM_PYPI_PASSWORD when there are no defaults in config #1961

Closed
1 task done
theredfoxlee opened this issue May 30, 2023 · 0 comments · Fixed by #1962
Closed
1 task done
Assignees
Labels
🐛 bug Something isn't working

Comments

@theredfoxlee
Copy link

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

Description

PDM ignores PDM_PYPI_USERNAME and PDM_PYPI_PASSWORD when there are no defaults in config.

Steps to reproduce

  1. Use PDM with version 2.7.0 without any user configuration.
  2. Define custom PDM_PYPI_URL environment variable (along with PDM_PYPI_USERNAME and PDM_PYPI_PASSWORD).
  3. Try to install any package (it will fail).
  4. Add dummy pypi.username and pypi.password to PDM's config.
  5. Try to install package from point 3 again (it will succeed to read PDM_PYPI_USERNAME and PDM_PYPI_PASSWORD).

Actual behavior

[janiec@janiec pdm-bug-test]$ pdm --version
PDM, version 2.7.0
[janiec@janiec pdm-bug-test]$ env | grep PDM | cut -d'=' -f1
PDM_PYPI_USERNAME
PDM_PYPI_URL
PDM_PYPI_PASSWORD
[janiec@janiec pdm-bug-test]$ pdm add black
Adding group default to lockfile
Adding packages to default dependencies: black
See /tmp/pdm-lock-rglptr1i.log for detailed debug log.
[PdmException]: The credentials for pkgs.dev.azure.com are not provided. To give them via interactive shell, please rerun the command with `-v` option.
Add '-v' to see the detailed traceback
[janiec@janiec pdm-bug-test]$ pdm config pypi.username foo
WARNING: the config is shadowed by env var 'PDM_PYPI_USERNAME', the value set won't take effect.
[janiec@janiec pdm-bug-test]$ pdm config pypi.password foo
WARNING: the config is shadowed by env var 'PDM_PYPI_PASSWORD', the value set won't take effect.
[janiec@scarlet pdm-bug-test]$ pdm add black
Adding group default to lockfile
Adding packages to default dependencies: black
🔒 Lock successful
Changes are written to pyproject.toml.
Synchronizing working set with lock file: 6 to add, 0 to update, 0 to removeInstall packaging 23.1 successfulInstall click 8.1.3 successfulInstall black 23.3.0 successfulInstall platformdirs 3.5.1 successfulInstall mypy-extensions 1.0.0 successfulInstall pathspec 0.11.1 successful

🎉 All complete!

Expected behavior

I expected PDM_PYPI_USERNAME and PDM_PYPI_PASSWORD to be read without having to create dummy entries in the PDM configuration. This issue is particularly noticeable in the Dockerfile, where PDM starts with a fresh configuration and is expected to read from private PyPI based on the environment variables.

@theredfoxlee theredfoxlee added the 🐛 bug Something isn't working label May 30, 2023
@frostming frostming self-assigned this May 30, 2023
frostming added a commit that referenced this issue May 30, 2023
…re no defaults in config

Fixes #1961

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