Skip to content

Commit 770d842

Browse files
committed
uv init: --virtual should imply --no-package instead
1 parent 0b02a8c commit 770d842

File tree

2 files changed

+7
-28
lines changed

2 files changed

+7
-28
lines changed

crates/uv/src/settings.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ impl InitSettings {
202202
(_, _, _) => unreachable!("`app`, `lib`, and `script` are mutually exclusive"),
203203
};
204204

205-
let package = flag(package || build_backend.is_some() || r#virtual, no_package)
205+
let package = flag(package || build_backend.is_some(), no_package || r#virtual)
206206
.unwrap_or(kind.packaged_by_default());
207207

208208
Self {

crates/uv/tests/it/init.rs

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1601,22 +1601,15 @@ fn init_virtual_project() -> Result<()> {
16011601
filters => context.filters(),
16021602
}, {
16031603
assert_snapshot!(
1604-
pyproject, @r###"
1604+
pyproject, @r#"
16051605
[project]
16061606
name = "foo"
16071607
version = "0.1.0"
16081608
description = "Add your description here"
16091609
readme = "README.md"
16101610
requires-python = ">=3.12"
16111611
dependencies = []
1612-
1613-
[project.scripts]
1614-
foo = "foo:main"
1615-
1616-
[build-system]
1617-
requires = ["hatchling"]
1618-
build-backend = "hatchling.build"
1619-
"###
1612+
"#
16201613
);
16211614
});
16221615

@@ -1635,7 +1628,7 @@ fn init_virtual_project() -> Result<()> {
16351628
filters => context.filters(),
16361629
}, {
16371630
assert_snapshot!(
1638-
pyproject, @r###"
1631+
pyproject, @r#"
16391632
[project]
16401633
name = "foo"
16411634
version = "0.1.0"
@@ -1644,16 +1637,9 @@ fn init_virtual_project() -> Result<()> {
16441637
requires-python = ">=3.12"
16451638
dependencies = []
16461639
1647-
[project.scripts]
1648-
foo = "foo:main"
1649-
1650-
[build-system]
1651-
requires = ["hatchling"]
1652-
build-backend = "hatchling.build"
1653-
16541640
[tool.uv.workspace]
16551641
members = ["bar"]
1656-
"###
1642+
"#
16571643
);
16581644
});
16591645

@@ -1730,22 +1716,15 @@ fn init_nested_virtual_workspace() -> Result<()> {
17301716
filters => context.filters(),
17311717
}, {
17321718
assert_snapshot!(
1733-
pyproject, @r###"
1719+
pyproject, @r#"
17341720
[project]
17351721
name = "foo"
17361722
version = "0.1.0"
17371723
description = "Add your description here"
17381724
readme = "README.md"
17391725
requires-python = ">=3.12"
17401726
dependencies = []
1741-
1742-
[project.scripts]
1743-
foo = "foo:main"
1744-
1745-
[build-system]
1746-
requires = ["hatchling"]
1747-
build-backend = "hatchling.build"
1748-
"###
1727+
"#
17491728
);
17501729
});
17511730

0 commit comments

Comments
 (0)