-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Warn if multiple indexes include default = true
#17713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -19250,6 +19250,45 @@ fn lock_repeat_named_index() -> Result<()> { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Ok(()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// If multiple indexes are marked as default within a single file, we should raise an error. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[test] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fn lock_multiple_default_indexes() -> Result<()> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let context = TestContext::new("3.12"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let pyproject_toml = context.temp_dir.child("pyproject.toml"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pyproject_toml.write_str( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| r#" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [project] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name = "project" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| version = "0.1.0" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| requires-python = ">=3.12" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dependencies = ["iniconfig"] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [[tool.uv.index]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name = "first" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| url = "https://pypi.org/simple" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| default = true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [[tool.uv.index]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name = "second" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| url = "https://example.com" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| default = true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "#, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| )?; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| uv_snapshot!(context.filters(), context.lock(), @" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| success: true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit_code: 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ----- stdout ----- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ----- stderr ----- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| warning: Found multiple indexes with `default = true`; only one index may be marked as default. This will become an error in the future. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Resolved 2 packages in [TIME] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Ok(()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /// If a name is defined in both the workspace root and the member, prefer the index in the member. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #[test] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fn lock_repeat_named_index_member() -> Result<()> { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -33274,6 +33313,7 @@ fn lock_check_multiple_default_indexes_explicit_assignment_dependency_group() -> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ----- stdout ----- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ----- stderr ----- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| warning: Found multiple indexes with `default = true`; only one index may be marked as default. This will become an error in the future. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have coverage for the case where there are multiple default indexes in a workspace defined in the root and a member? What do we expect there?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We currently just don't load indexes from workspace members if we're in a workspace. The only time we look at the indexes is when they're referenced as a source. So basically all indexes in a member implicitly act like they have "explicit" set.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The logic is in here: Lines 144 to 178 in b73f6cb
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Resolved 2 packages in [TIME] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -33324,6 +33364,7 @@ fn lock_check_multiple_default_indexes_explicit_assignment_dependency_group() -> | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ----- stdout ----- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ----- stderr ----- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| warning: Found multiple indexes with `default = true`; only one index may be marked as default. This will become an error in the future. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Resolved 2 packages in [TIME] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(just for consistency with some other warnings)