Pin dependencies to specific indexes using UV's named index feature #333
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR addresses the requirement to pin dependencies in
requirements.compiledto specific indexes, as mentioned in the issue referencing astral-sh/uv#171.Problem
Previously, the dependency compiler used unnamed index URLs (
--index-urland--extra-index-url) without explicitly specifying which indexes should be used during compilation. This approach:Solution
Updated the
DependencyCompilerto use UV's named index feature:--default-index <url>for the primary PyPI index--index <name>=<url>for additional indexes (e.g., AMD/NVIDIA PyTorch indexes)Changes Made
Enhanced
DependencyCompiler.Compile()method: Added anindexesparameter to accept a dictionary of named indexes, enabling explicit control over package sources during compilation.Added
_build_indexes()helper method: Automatically constructs a dictionary of named indexes based on GPU configuration, mapping "pypi" to the main PyPI index and "amd"/"nvidia" to the appropriate PyTorch index.Updated compilation calls: Both
make_override()andcompile_core_plus_ext()now pass the indexes dictionary to ensure consistent use of named indexes throughout the compilation process.Example
Before:
After:
Benefits
--index-urland--extra-index-urlin the compiled file)Testing
Closes #[issue_number]
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
api.mixpanel.compython3 -m pytest tests/ -v --tb=short(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Fixes #189
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.