pdm-pip-index-url
June 18, 2023 ยท View on GitHub
pdm-pip-index-url is a pdm plugin that automatically converts PIP_*INDEX_URL to PDM_PYPI_* envs.
For each pdm sub-command invocation, pdm will search for PIP_*INDEX_URL environment variables to convert them to coressponding PDM_PYPI_* values (see process_pip_envs in ./plugin.py for detailed logic description).
Usage
- Install plugin:
pdm self add pdm-pip-index-url
Logging
Turn on logging by adding -v to executed command, e.g.: pdm add -v black.
Example [Use Case]
Consider a scenario where you are using PDM in an environment that does not provide a way to authenticate it to a private PyPI server but supports pip authentication (e.g., Azure Pipelines). Here is an example:
# 1. Set PIP_INDEX_URL for <private-feed>.
- task: PipAuthenticate@1
inputs:
artifactFeeds: <private-feed>
# 2. Install pdm.
- script: pip install pdm==2.7.4
# 3. Install this plugin.
- script: pdm self add pdm-pip-index-url==0.1.1
# 4. Use PIP_INDEX_URL env to install <private-package> from <private-feed>.
- script: pdm add <private-package>