mirror of https://github.com/astral-sh/uv
uv init: `--virtual` should imply `--no-package` instead (#8595)
## Summary `uv init --virtual` should create a non-package project.
This commit is contained in:
parent
bf14b6a282
commit
d9ea307615
|
|
@ -202,7 +202,7 @@ impl InitSettings {
|
||||||
(_, _, _) => unreachable!("`app`, `lib`, and `script` are mutually exclusive"),
|
(_, _, _) => unreachable!("`app`, `lib`, and `script` are mutually exclusive"),
|
||||||
};
|
};
|
||||||
|
|
||||||
let package = flag(package || build_backend.is_some() || r#virtual, no_package)
|
let package = flag(package || build_backend.is_some(), no_package || r#virtual)
|
||||||
.unwrap_or(kind.packaged_by_default());
|
.unwrap_or(kind.packaged_by_default());
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
|
|
|
||||||
|
|
@ -1601,7 +1601,7 @@ fn init_virtual_project() -> Result<()> {
|
||||||
filters => context.filters(),
|
filters => context.filters(),
|
||||||
}, {
|
}, {
|
||||||
assert_snapshot!(
|
assert_snapshot!(
|
||||||
pyproject, @r###"
|
pyproject, @r#"
|
||||||
[project]
|
[project]
|
||||||
name = "foo"
|
name = "foo"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
@ -1609,14 +1609,7 @@ fn init_virtual_project() -> Result<()> {
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.12"
|
requires-python = ">=3.12"
|
||||||
dependencies = []
|
dependencies = []
|
||||||
|
"#
|
||||||
[project.scripts]
|
|
||||||
foo = "foo:main"
|
|
||||||
|
|
||||||
[build-system]
|
|
||||||
requires = ["hatchling"]
|
|
||||||
build-backend = "hatchling.build"
|
|
||||||
"###
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1635,7 +1628,7 @@ fn init_virtual_project() -> Result<()> {
|
||||||
filters => context.filters(),
|
filters => context.filters(),
|
||||||
}, {
|
}, {
|
||||||
assert_snapshot!(
|
assert_snapshot!(
|
||||||
pyproject, @r###"
|
pyproject, @r#"
|
||||||
[project]
|
[project]
|
||||||
name = "foo"
|
name = "foo"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
@ -1644,16 +1637,9 @@ fn init_virtual_project() -> Result<()> {
|
||||||
requires-python = ">=3.12"
|
requires-python = ">=3.12"
|
||||||
dependencies = []
|
dependencies = []
|
||||||
|
|
||||||
[project.scripts]
|
|
||||||
foo = "foo:main"
|
|
||||||
|
|
||||||
[build-system]
|
|
||||||
requires = ["hatchling"]
|
|
||||||
build-backend = "hatchling.build"
|
|
||||||
|
|
||||||
[tool.uv.workspace]
|
[tool.uv.workspace]
|
||||||
members = ["bar"]
|
members = ["bar"]
|
||||||
"###
|
"#
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1730,7 +1716,7 @@ fn init_nested_virtual_workspace() -> Result<()> {
|
||||||
filters => context.filters(),
|
filters => context.filters(),
|
||||||
}, {
|
}, {
|
||||||
assert_snapshot!(
|
assert_snapshot!(
|
||||||
pyproject, @r###"
|
pyproject, @r#"
|
||||||
[project]
|
[project]
|
||||||
name = "foo"
|
name = "foo"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
@ -1738,14 +1724,7 @@ fn init_nested_virtual_workspace() -> Result<()> {
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.12"
|
requires-python = ">=3.12"
|
||||||
dependencies = []
|
dependencies = []
|
||||||
|
"#
|
||||||
[project.scripts]
|
|
||||||
foo = "foo:main"
|
|
||||||
|
|
||||||
[build-system]
|
|
||||||
requires = ["hatchling"]
|
|
||||||
build-backend = "hatchling.build"
|
|
||||||
"###
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue