Skip to content

Credentials for additional indexes configured with PDM are not passed to uv #3553

@michaelze

Description

@michaelze

Describe the bug

I have several indexes configured with PDM in the global config file (~/.config/pdm/config.toml). One is a mirror for PyPI, the others are additional internal indexes. All indexes require authentication.
When using uv with PDM (PDM_USE_UV = True), all the indexes are passed to uv on the command line but without the credentials which obviously causes operations trying to access these indexes to fail.

To reproduce

  1. Use latest PDM (tested with 2.25.0) and also install uv (tested with 0.7.13)
  2. Configure an index with PDM that requires authentication in ~/.config/pdm/config.toml
  3. Create a new empty project (pdm init) and configure it to use uv (pdm config -l use_uv true)
  4. Try to install a dependency that is only available on the the private index
  5. The installation fails with the following message: "No solution found when resolving dependencies: Because was not found in the package registry and your project depends on , we can conclude that your project's requirements are unsatisfiable."

At the moment I can work around this issue, by providing a uv config (~/.config/uv/uv.conf) that repeats the indexes configured with PDM.

Expected Behavior

Ideally, PDM would pass the credentials for its configured indexes to uv when it is called under the hood.

Environment Information

PDM version:
  2.25.0
Python Interpreter:
  /home/<redacted>/tmp/uv-test-credentials/.venv/bin/python (3.10)
Project Root:
  /home/<redacted>/tmp/uv-test-credentials
Local Packages:

INFO: PDM 2.25.0 is installed, while 2.25.3 is available.
Please run `pdm self update` to upgrade.
Run `pdm config check_update false` to disable the check.
{
  "implementation_name": "cpython",
  "implementation_version": "3.10.17",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "6.6.87.2-microsoft-standard-WSL2",
  "platform_system": "Linux",
  "platform_version": "#1 SMP PREEMPT_DYNAMIC Thu Jun  5 18:30:46 UTC 2025",
  "python_full_version": "3.10.17",
  "platform_python_implementation": "CPython",
  "python_version": "3.10",
  "sys_platform": "linux"
}
INFO: PDM 2.25.0 is installed, while 2.25.3 is available.
Please run `pdm self update` to upgrade.
Run `pdm config check_update false` to disable the check.

Verbose Command Output

Adding packages to default dependencies: <redacted-package>
INFO: Using uv is experimental and might break due to uv updates.
Running uv lock command: ['/home/<redacted-user>/dev/python/python3.10-pdm2.25.0/bin/python3', '-m', 'uv', 'lock', '-p', '/home/<redacted-user>/tmp/uv-test-credentials/.venv/bin/python', '--verbose', '--index-url', 'https://<redacted-host>/repository/api/pypi/pypi-remote/simple', '--extra-index-url', 'https://<redacted-host>/repository/api/pypi/<redacted-repo1>/simple', '--extra-index-url',
'https://<redacted-host>/repository/api/pypi/<redacted-repo2>/simple', '--index-strategy=unsafe-best-match', '-P', '<redacted-package>']
DEBUG uv 0.7.13
DEBUG Found workspace root: `/home/<redacted-user>/tmp/uv-test-credentials`
DEBUG Adding root workspace member: `/home/<redacted-user>/tmp/uv-test-credentials`
DEBUG Using Python request `/home/<redacted-user>/tmp/uv-test-credentials/.venv/bin/python` from explicit request
DEBUG Checking for Python environment at `.venv`
DEBUG The project environment's Python version satisfies the request: `path `.venv/bin/python``
DEBUG Using request timeout of 30s
DEBUG Ignoring existing lockfile due to `--upgrade-package`
DEBUG Found static `pyproject.toml` for: uv-test-credentials @ file:///home/<redacted-user>/tmp/uv-test-credentials
DEBUG No workspace root found, using project root
DEBUG Solving with installed Python version: 3.10.17
DEBUG Solving with target Python version: ==3.10.*
DEBUG Adding direct dependency: uv-test-credentials*
DEBUG Searching for a compatible version of uv-test-credentials @ file:///home/<redacted-user>/tmp/uv-test-credentials (*)
DEBUG Adding direct dependency: <redacted-package>*
DEBUG Found stale response for: https://<redacted-host>/repository/api/pypi/<redacted-repo1>/simple/<redacted-package>/
DEBUG Sending revalidation request for: https://<redacted-host>/repository/api/pypi/<redacted-repo1>/simple/<redacted-package>/
DEBUG No cache entry for: https://<redacted-host>/repository/api/pypi/pypi-remote/simple/<redacted-package>/
DEBUG Found stale response for: https://<redacted-host>/repository/api/pypi/<redacted-repo2>/simple/<redacted-package>/
DEBUG Sending revalidation request for: https://<redacted-host>/repository/api/pypi/<redacted-repo2>/simple/<redacted-package>/
DEBUG No netrc file found
DEBUG Searching for a compatible version of <redacted-package> (*)
DEBUG No compatible version found for: <redacted-package>
DEBUG Recording unit propagation conflict of <redacted-package> from incompatibility of (uv-test-credentials)
DEBUG Searching for a compatible version of uv-test-credentials @ file:///home/<redacted-user>/tmp/uv-test-credentials (<0.1.0 | >0.1.0)
DEBUG No compatible version found for: uv-test-credentials
  × No solution found when resolving dependencies:
  ╰─▶ Because <redacted-package> was not found in the package registry and your project depends on <redacted-package>, we can conclude that your project's requirements are unsatisfiable.
Traceback (most recent call last):
  File "/home/<redacted-user>/dev/python/python3.10-pdm2.25.0/bin/pdm", line 8, in <module>
    sys.exit(main())
  File "/home/<redacted-user>/dev/python/python3.10-pdm2.25.0/lib/python3.10/site-packages/pdm/core.py", line 391, in main
    return core.main(args or sys.argv[1:])
  File "/home/<redacted-user>/dev/python/python3.10-pdm2.25.0/lib/python3.10/site-packages/pdm/core.py", line 270, in main
    raise cast(Exception, err).with_traceback(traceback) from None
  File "/home/<redacted-user>/dev/python/python3.10-pdm2.25.0/lib/python3.10/site-packages/pdm/core.py", line 265, in main
    self.handle(project, options)
  File "/home/<redacted-user>/dev/python/python3.10-pdm2.25.0/lib/python3.10/site-packages/pdm/core.py", line 195, in handle
    command.handle(project, options)
  File "/home/<redacted-user>/dev/python/python3.10-pdm2.25.0/lib/python3.10/site-packages/pdm/cli/commands/add.py", line 71, in handle
    self.do_add(
  File "/home/<redacted-user>/dev/python/python3.10-pdm2.25.0/lib/python3.10/site-packages/pdm/cli/commands/add.py", line 159, in do_add
    resolved = do_lock(
  File "/home/<redacted-user>/dev/python/python3.10-pdm2.25.0/lib/python3.10/site-packages/pdm/cli/actions.py", line 135, in do_lock
    resolved, new_groups = resolver.resolve()
  File "/home/<redacted-user>/dev/python/python3.10-pdm2.25.0/lib/python3.10/site-packages/pdm/resolver/uv.py", line 188, in resolve
    subprocess.run(uv_lock_command, cwd=self.project.root, check=True)
  File "/home/<redacted-user>/dev/python/python3.10-pdm2.25.0/lib/python3.10/subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/home/<redacted-user>/dev/python/python3.10-pdm2.25.0/bin/python3', '-m', 'uv', 'lock', '-p', '/home/<redacted-user>/tmp/uv-test-credentials/.venv/bin/python', '--verbose', '--index-url', 'https://<redacted-host>/repository/api/pypi/pypi-remote/simple', '--extra-index-url', 'https://<redacted-host>/repository/api/pypi/<redacted-repo1>/simple', '--extra-index-url', 'https://<redacted-host>/repository/api/pypi/<redacted-repo2>/simple', '--index-strategy=unsafe-best-match', '-P', '<redacted-package>']' returned non-zero exit status 1.

Additional Context

No response

Are you willing to submit a PR to fix this bug?

  • Yes, I would like to submit a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions