Skip to content

Commit 82aab8e

Browse files
committed
allow version to handle full virtual pyprojects
1 parent 2788535 commit 82aab8e

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

crates/uv/src/commands/project/version.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ async fn find_target(project_dir: &Path, package: Option<&PackageName>) -> Resul
231231
.with_context(|| format!("Package `{package}` not found in workspace"))?,
232232
)
233233
} else {
234-
VirtualProject::discover(
234+
VirtualProject::discover_defaulted(
235235
project_dir,
236236
&DiscoveryOptions::default(),
237237
&WorkspaceCache::default(),

crates/uv/tests/it/version.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1972,7 +1972,7 @@ fn virtual_empty() -> Result<()> {
19721972
----- stdout -----
19731973
19741974
----- stderr -----
1975-
error: No `project` table found in: `[TEMP_DIR]/pyproject.toml`
1975+
error: Missing `project.name` field in: pyproject.toml
19761976
");
19771977

19781978
let pyproject_toml = context.read("pyproject.toml");
@@ -1996,7 +1996,7 @@ fn virtual_empty() -> Result<()> {
19961996
----- stdout -----
19971997
19981998
----- stderr -----
1999-
error: No `project` table found in: `[TEMP_DIR]/pyproject.toml`
1999+
error: Missing `project.name` field in: pyproject.toml
20002000
");
20012001

20022002
let pyproject_toml = context.read("pyproject.toml");
@@ -2032,13 +2032,12 @@ fn add_virtual_dependency_group() -> Result<()> {
20322032

20332033
// Get the version (doesn't make sense)
20342034
uv_snapshot!(context.filters(), context.version(), @r"
2035-
success: true
2036-
exit_code: 0
2035+
success: false
2036+
exit_code: 2
20372037
----- stdout -----
2038-
uv [VERSION] ([COMMIT] DATE)
20392038
20402039
----- stderr -----
2041-
warning: Failed to read project metadata (No `project` table found in: `[TEMP_DIR]/pyproject.toml`). Running `uv self version` for compatibility. This fallback will be removed in the future; pass `--preview` to force an error.
2040+
error: Missing `project.name` field in: pyproject.toml
20422041
");
20432042

20442043
let pyproject_toml = context.read("pyproject.toml");
@@ -2064,7 +2063,7 @@ fn add_virtual_dependency_group() -> Result<()> {
20642063
----- stdout -----
20652064
20662065
----- stderr -----
2067-
error: No `project` table found in: `[TEMP_DIR]/pyproject.toml`
2066+
error: Missing `project.name` field in: pyproject.toml
20682067
");
20692068

20702069
let pyproject_toml = context.read("pyproject.toml");

0 commit comments

Comments
 (0)