pdm icon indicating copy to clipboard operation
pdm copied to clipboard

Calling default index packages when overrided by `pypi.url` config value

Open KacperGawdzinski opened this issue 2 months ago • 3 comments

Describe the bug

Hello! I'm using multiple package indexes along with PDM. Since we can't use pyproject.toml for the configuration due to missing environment variable interpolation, we can't internally set the credentials as plain text and upload to git.

That's why I've followed an issue which led to multiple config indexes and tried it as it would solve our problems.

I've set two respositories with: pdm config pypi.url for our package mirror and pdm config pypi.internal.url for internal packages I've also added correspoding credentials to each of them.

I thought it should disable default pypi https://pypi.org/simple repository as I did override it's value but after inspecting outgoing http traffic from my machine I've noticed:

Image

The first two lines are indeed my pypi.url and pypi.internal.url but the call to https://pypi.org/simple was made anyway.

As I tested with pyproject.toml, if I was to set the package registries there, then the call to pypi default registry is not made. I'd like the pdm config to behave the same way.

To reproduce

set pdm config pypi.url set pdm config pypi.internal.url set their credentials

fetch any package, a call to https://pypi.org/simple is made

Expected Behavior

If pdm config pypi.url is set, the default pypi registry will not be used. If there are no matching packages the command should fail.

Environment Information

PDM version: 2.26.1 Python Interpreter: /Users/user/repos/project/.venv/bin/python (3.12) Project Root: /Users/user/repos/project Local Packages: /Users/user/repos/project/.venv/lib/python3.12/site-packages

{ "implementation_name": "cpython", "implementation_version": "3.14.0", "os_name": "posix", "platform_machine": "arm64", "platform_release": "25.0.0", "platform_system": "Darwin", "platform_version": "Darwin Kernel Version 25.0.0: Wed Sep 17 21:41:26 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6041", "python_full_version": "3.12.12", "platform_python_implementation": "CPython", "python_version": "3.12", "sys_platform": "darwin" }

Verbose Command Output

No response

Additional Context

No response

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

  • [ ] Yes, I would like to submit a PR.

KacperGawdzinski avatar Nov 07 '25 10:11 KacperGawdzinski

Make sure your index doesn't redirect non-existing package requests to PyPI. That is quite common in index implementations.

frostming avatar Nov 08 '25 00:11 frostming

This is not the case, if I would use pyproject.toml with [[tool.pdm.source]] then it's behaving the expected way with no call to https://pypi.org/simple

KacperGawdzinski avatar Nov 10 '25 10:11 KacperGawdzinski

I can't reproduce it, could you track where the request is initiated from? btw did you enable check_update, that is always checking what pypi.url is configured to

frostming avatar Nov 11 '25 02:11 frostming