-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Summary
Issue Description
I am experiencing an issue where uv fails to recognize an index defined in uv.toml when that index is explicitly referenced by a dependency in pyproject.toml. It appears that uv attempts to validate the dependency source in pyproject.toml before fully loading or merging the index configuration from uv.toml.
Use Case & Context
We use an internal package registry that must be set as explicit due to security requirements. We maintain two separate configuration files to handle deployment constraints:
uv.toml: Used for local development (contains pypi index requiring internet connection).uv.prod.toml: Used for production (disconnected from the internet, renamed touv.tomlby CI/CD Pipeline).
We rely on uv.toml for the index definition because pyproject.toml does not allow us to easily swap configurations based on the environment (local vs. prod) without modifying the version-controlled project file itself.
Reproduction Steps
- Define an internal index in
uv.tomlwith a specific name and mark it as explicit. - Add a dependency in
pyproject.tomlusingtool.uv.sourcesand explicitly assign it to the index name defined in step 1. - Run
uv sync.
Example Configuration
uv.toml:
[[index]]
name = "gitlab"
url = "https://gitlab.example.com/api/v4/projects/1/packages/pypi/simple"
explicit = truepyproject.toml:
[project]
name = "uv-bug-report"
version = "0.1.0"
requires-python = ">=3.13"
dependencies = [
"my-custom-package >= 0.1.0"
]
[tool.uv.sources]
my-custom-package = { index = "gitlab" }Console output
> uv sync
x Failed to build `uv-bug-report @ file:///C:/Users/rothadam/PycharmProjects/uv-bug-report`
|-> Failed to parse entry: `my-custom-package`
`-> Package `my-custom-package` references an undeclared index: `gitlab`Platform
Windows 11 x86_64 Enterprise 25H2 (build 26200.7840)
Version
uv 0.10.3 (c75a0c6 2026-02-16)
Python version
Python 3.13.5