Skip to content

index-strategy: first-match or first-index? #10031

@yaochie

Description

@yaochie

Not sure if this is a documentation issue or a bug.

The documentation shows both first-match and first-index as possible options for index-strategy:

--help also only shows first-index as a possible value:

$ uv add --help    #also for uv pip install --help
...
Index options:
...
      --no-index
          Ignore the registry index (e.g., PyPI), instead relying on direct URL dependencies and
          those provided via `--find-links`
      --index-strategy <INDEX_STRATEGY>
          The strategy to use when resolving against multiple index URLs [env: UV_INDEX_STRATEGY=]
          [possible values: first-index, unsafe-first-match, unsafe-best-match]
      --keyring-provider <KEYRING_PROVIDER>
          Attempt to use `keyring` for authentication for index URLs [env: UV_KEYRING_PROVIDER=]
          [possible values: disabled, subprocess]

I tried to set the index strategy using (uv 0.5.10):

  • --index-strategy
  • UV_INDEX_STRATEGY
  • pyproject.toml

Both first-index and first-match work when set using --index-strategy or UV_INDEX_STRATEGY, but only first-index works in pyproject.toml, not sure if this is intended:

warning: Failed to parse `pyproject.toml` during settings discovery:
  TOML parse error at line 10, column 18
     |
  10 | index-strategy = "first-match"
     |                  ^^^^^^^^^^^^^
  unknown variant `first-match`, expected one of `first-index`, `unsafe-any-match`, `unsafe-first-match`, `unsafe-best-match`

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdocumentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions