mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Simplify the packse scenario package name filters (#2440)
I liked the bird names but we can't actually apply those in some situations (i.e. when the package is not supposed to exist) — this is simpler.
This commit is contained in:
parent
104c74d911
commit
044a77cfd2
5 changed files with 375 additions and 607 deletions
|
@ -68,8 +68,7 @@ fn incompatible_python_compatible_override() -> Result<()> {
|
|||
|
||||
// In addition to the standard filters, swap out package names for more realistic messages
|
||||
let mut filters = INSTA_FILTERS.to_vec();
|
||||
filters.push((r"incompatible-python-compatible-override-a", "albatross"));
|
||||
filters.push((r"incompatible-python-compatible-override-", "pkg-"));
|
||||
filters.push((r"incompatible-python-compatible-override-", "package-"));
|
||||
|
||||
let requirements_in = context.temp_dir.child("requirements.in");
|
||||
requirements_in.write_str("incompatible-python-compatible-override-a==1.0.0")?;
|
||||
|
@ -82,7 +81,7 @@ fn incompatible_python_compatible_override() -> Result<()> {
|
|||
----- stdout -----
|
||||
# This file was autogenerated by uv via the following command:
|
||||
# uv pip compile requirements.in --cache-dir [CACHE_DIR] --python-version=3.11
|
||||
albatross==1.0.0
|
||||
package-a==1.0.0
|
||||
|
||||
----- stderr -----
|
||||
warning: The requested Python version 3.11 is not available; 3.9.18 will be used to build dependencies instead.
|
||||
|
@ -118,8 +117,7 @@ fn compatible_python_incompatible_override() -> Result<()> {
|
|||
|
||||
// In addition to the standard filters, swap out package names for more realistic messages
|
||||
let mut filters = INSTA_FILTERS.to_vec();
|
||||
filters.push((r"compatible-python-incompatible-override-a", "albatross"));
|
||||
filters.push((r"compatible-python-incompatible-override-", "pkg-"));
|
||||
filters.push((r"compatible-python-incompatible-override-", "package-"));
|
||||
|
||||
let requirements_in = context.temp_dir.child("requirements.in");
|
||||
requirements_in.write_str("compatible-python-incompatible-override-a==1.0.0")?;
|
||||
|
@ -134,8 +132,8 @@ fn compatible_python_incompatible_override() -> Result<()> {
|
|||
----- stderr -----
|
||||
warning: The requested Python version 3.9 is not available; 3.11.7 will be used to build dependencies instead.
|
||||
× No solution found when resolving dependencies:
|
||||
╰─▶ Because the requested Python version (3.9) does not satisfy Python>=3.10 and albatross==1.0.0 depends on Python>=3.10, we can conclude that albatross==1.0.0 cannot be used.
|
||||
And because you require albatross==1.0.0, we can conclude that the requirements are unsatisfiable.
|
||||
╰─▶ Because the requested Python version (3.9) does not satisfy Python>=3.10 and package-a==1.0.0 depends on Python>=3.10, we can conclude that package-a==1.0.0 cannot be used.
|
||||
And because you require package-a==1.0.0, we can conclude that the requirements are unsatisfiable.
|
||||
"###
|
||||
);
|
||||
|
||||
|
@ -166,13 +164,9 @@ fn incompatible_python_compatible_override_unavailable_no_wheels() -> Result<()>
|
|||
|
||||
// In addition to the standard filters, swap out package names for more realistic messages
|
||||
let mut filters = INSTA_FILTERS.to_vec();
|
||||
filters.push((
|
||||
r"incompatible-python-compatible-override-unavailable-no-wheels-a",
|
||||
"albatross",
|
||||
));
|
||||
filters.push((
|
||||
r"incompatible-python-compatible-override-unavailable-no-wheels-",
|
||||
"pkg-",
|
||||
"package-",
|
||||
));
|
||||
|
||||
let requirements_in = context.temp_dir.child("requirements.in");
|
||||
|
@ -192,8 +186,8 @@ fn incompatible_python_compatible_override_unavailable_no_wheels() -> Result<()>
|
|||
----- stderr -----
|
||||
warning: The requested Python version 3.11 is not available; 3.9.18 will be used to build dependencies instead.
|
||||
× No solution found when resolving dependencies:
|
||||
╰─▶ Because the current Python version (3.9.18) does not satisfy Python>=3.10 and albatross==1.0.0 depends on Python>=3.10, we can conclude that albatross==1.0.0 cannot be used.
|
||||
And because you require albatross==1.0.0, we can conclude that the requirements are unsatisfiable.
|
||||
╰─▶ Because the current Python version (3.9.18) does not satisfy Python>=3.10 and package-a==1.0.0 depends on Python>=3.10, we can conclude that package-a==1.0.0 cannot be used.
|
||||
And because you require package-a==1.0.0, we can conclude that the requirements are unsatisfiable.
|
||||
"###
|
||||
);
|
||||
|
||||
|
@ -226,13 +220,9 @@ fn incompatible_python_compatible_override_available_no_wheels() -> Result<()> {
|
|||
|
||||
// In addition to the standard filters, swap out package names for more realistic messages
|
||||
let mut filters = INSTA_FILTERS.to_vec();
|
||||
filters.push((
|
||||
r"incompatible-python-compatible-override-available-no-wheels-a",
|
||||
"albatross",
|
||||
));
|
||||
filters.push((
|
||||
r"incompatible-python-compatible-override-available-no-wheels-",
|
||||
"pkg-",
|
||||
"package-",
|
||||
));
|
||||
|
||||
let requirements_in = context.temp_dir.child("requirements.in");
|
||||
|
@ -249,7 +239,7 @@ fn incompatible_python_compatible_override_available_no_wheels() -> Result<()> {
|
|||
----- stdout -----
|
||||
# This file was autogenerated by uv via the following command:
|
||||
# uv pip compile requirements.in --cache-dir [CACHE_DIR] --python-version=3.11
|
||||
albatross==1.0.0
|
||||
package-a==1.0.0
|
||||
|
||||
----- stderr -----
|
||||
Resolved 1 package in [TIME]
|
||||
|
@ -285,13 +275,9 @@ fn incompatible_python_compatible_override_no_compatible_wheels() -> Result<()>
|
|||
|
||||
// In addition to the standard filters, swap out package names for more realistic messages
|
||||
let mut filters = INSTA_FILTERS.to_vec();
|
||||
filters.push((
|
||||
r"incompatible-python-compatible-override-no-compatible-wheels-a",
|
||||
"albatross",
|
||||
));
|
||||
filters.push((
|
||||
r"incompatible-python-compatible-override-no-compatible-wheels-",
|
||||
"pkg-",
|
||||
"package-",
|
||||
));
|
||||
|
||||
let requirements_in = context.temp_dir.child("requirements.in");
|
||||
|
@ -311,8 +297,8 @@ fn incompatible_python_compatible_override_no_compatible_wheels() -> Result<()>
|
|||
----- stderr -----
|
||||
warning: The requested Python version 3.11 is not available; 3.9.18 will be used to build dependencies instead.
|
||||
× No solution found when resolving dependencies:
|
||||
╰─▶ Because the current Python version (3.9.18) does not satisfy Python>=3.10 and albatross==1.0.0 depends on Python>=3.10, we can conclude that albatross==1.0.0 cannot be used.
|
||||
And because you require albatross==1.0.0, we can conclude that the requirements are unsatisfiable.
|
||||
╰─▶ Because the current Python version (3.9.18) does not satisfy Python>=3.10 and package-a==1.0.0 depends on Python>=3.10, we can conclude that package-a==1.0.0 cannot be used.
|
||||
And because you require package-a==1.0.0, we can conclude that the requirements are unsatisfiable.
|
||||
"###
|
||||
);
|
||||
|
||||
|
@ -347,13 +333,9 @@ fn incompatible_python_compatible_override_other_wheel() -> Result<()> {
|
|||
|
||||
// In addition to the standard filters, swap out package names for more realistic messages
|
||||
let mut filters = INSTA_FILTERS.to_vec();
|
||||
filters.push((
|
||||
r"incompatible-python-compatible-override-other-wheel-a",
|
||||
"albatross",
|
||||
));
|
||||
filters.push((
|
||||
r"incompatible-python-compatible-override-other-wheel-",
|
||||
"pkg-",
|
||||
"package-",
|
||||
));
|
||||
|
||||
let requirements_in = context.temp_dir.child("requirements.in");
|
||||
|
@ -373,15 +355,15 @@ fn incompatible_python_compatible_override_other_wheel() -> Result<()> {
|
|||
----- stderr -----
|
||||
warning: The requested Python version 3.11 is not available; 3.9.18 will be used to build dependencies instead.
|
||||
× No solution found when resolving dependencies:
|
||||
╰─▶ Because the current Python version (3.9.18) does not satisfy Python>=3.10 and albatross==1.0.0 depends on Python>=3.10, we can conclude that albatross==1.0.0 cannot be used.
|
||||
And because only the following versions of albatross are available:
|
||||
albatross==1.0.0
|
||||
albatross==2.0.0
|
||||
we can conclude that albatross<2.0.0 cannot be used. (1)
|
||||
╰─▶ Because the current Python version (3.9.18) does not satisfy Python>=3.10 and package-a==1.0.0 depends on Python>=3.10, we can conclude that package-a==1.0.0 cannot be used.
|
||||
And because only the following versions of package-a are available:
|
||||
package-a==1.0.0
|
||||
package-a==2.0.0
|
||||
we can conclude that package-a<2.0.0 cannot be used. (1)
|
||||
|
||||
Because the requested Python version (3.11) does not satisfy Python>=3.12 and albatross==2.0.0 depends on Python>=3.12, we can conclude that albatross==2.0.0 cannot be used.
|
||||
And because we know from (1) that albatross<2.0.0 cannot be used, we can conclude that all versions of albatross cannot be used.
|
||||
And because you require albatross, we can conclude that the requirements are unsatisfiable.
|
||||
Because the requested Python version (3.11) does not satisfy Python>=3.12 and package-a==2.0.0 depends on Python>=3.12, we can conclude that package-a==2.0.0 cannot be used.
|
||||
And because we know from (1) that package-a<2.0.0 cannot be used, we can conclude that all versions of package-a cannot be used.
|
||||
And because you require package-a, we can conclude that the requirements are unsatisfiable.
|
||||
"###
|
||||
);
|
||||
|
||||
|
@ -411,8 +393,7 @@ fn python_patch_override_no_patch() -> Result<()> {
|
|||
|
||||
// In addition to the standard filters, swap out package names for more realistic messages
|
||||
let mut filters = INSTA_FILTERS.to_vec();
|
||||
filters.push((r"python-patch-override-no-patch-a", "albatross"));
|
||||
filters.push((r"python-patch-override-no-patch-", "pkg-"));
|
||||
filters.push((r"python-patch-override-no-patch-", "package-"));
|
||||
|
||||
let requirements_in = context.temp_dir.child("requirements.in");
|
||||
requirements_in.write_str("python-patch-override-no-patch-a==1.0.0")?;
|
||||
|
@ -428,8 +409,8 @@ fn python_patch_override_no_patch() -> Result<()> {
|
|||
|
||||
----- stderr -----
|
||||
× No solution found when resolving dependencies:
|
||||
╰─▶ Because the requested Python version (3.8) does not satisfy Python>=3.8.4 and albatross==1.0.0 depends on Python>=3.8.4, we can conclude that albatross==1.0.0 cannot be used.
|
||||
And because you require albatross==1.0.0, we can conclude that the requirements are unsatisfiable.
|
||||
╰─▶ Because the requested Python version (3.8) does not satisfy Python>=3.8.4 and package-a==1.0.0 depends on Python>=3.8.4, we can conclude that package-a==1.0.0 cannot be used.
|
||||
And because you require package-a==1.0.0, we can conclude that the requirements are unsatisfiable.
|
||||
"###
|
||||
);
|
||||
|
||||
|
@ -459,8 +440,7 @@ fn python_patch_override_patch_compatible() -> Result<()> {
|
|||
|
||||
// In addition to the standard filters, swap out package names for more realistic messages
|
||||
let mut filters = INSTA_FILTERS.to_vec();
|
||||
filters.push((r"python-patch-override-patch-compatible-a", "albatross"));
|
||||
filters.push((r"python-patch-override-patch-compatible-", "pkg-"));
|
||||
filters.push((r"python-patch-override-patch-compatible-", "package-"));
|
||||
|
||||
let requirements_in = context.temp_dir.child("requirements.in");
|
||||
requirements_in.write_str("python-patch-override-patch-compatible-a==1.0.0")?;
|
||||
|
@ -473,7 +453,7 @@ fn python_patch_override_patch_compatible() -> Result<()> {
|
|||
----- stdout -----
|
||||
# This file was autogenerated by uv via the following command:
|
||||
# uv pip compile requirements.in --cache-dir [CACHE_DIR] --python-version=3.8.0
|
||||
albatross==1.0.0
|
||||
package-a==1.0.0
|
||||
|
||||
----- stderr -----
|
||||
warning: The requested Python version 3.8.0 is not available; 3.8.18 will be used to build dependencies instead.
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -55,17 +55,6 @@ TESTS = PROJECT_ROOT / "crates" / "uv" / "tests"
|
|||
INSTALL_TESTS = TESTS / "pip_install_scenarios.rs"
|
||||
COMPILE_TESTS = TESTS / "pip_compile_scenarios.rs"
|
||||
|
||||
CUTE_NAMES = {
|
||||
"a": "albatross",
|
||||
"b": "bluebird",
|
||||
"c": "crow",
|
||||
"d": "duck",
|
||||
"e": "eagle",
|
||||
"f": "flamingo",
|
||||
"g": "goose",
|
||||
"h": "heron",
|
||||
}
|
||||
|
||||
try:
|
||||
import packse
|
||||
import packse.inspect
|
||||
|
@ -157,11 +146,6 @@ def main(scenarios: list[Path], snapshot_update: bool = True):
|
|||
"explanation"
|
||||
] = "We do not have correct behavior for local version identifiers yet"
|
||||
|
||||
# Generate cute names for each scenario
|
||||
for scenario in data["scenarios"]:
|
||||
for package in scenario["packages"]:
|
||||
package["cute_name"] = CUTE_NAMES[package["name"].rsplit("-")[-1]]
|
||||
|
||||
# Split scenarios into `install` and `compile` cases
|
||||
install_scenarios = []
|
||||
compile_scenarios = []
|
||||
|
|
|
@ -63,12 +63,9 @@ fn {{module_name}}() -> Result<()> {
|
|||
let context = TestContext::new("{{environment.python}}");
|
||||
let python_versions = &[{{#environment.additional_python}}"{{.}}", {{/environment.additional_python}}];
|
||||
|
||||
// In addition to the standard filters, swap out package names for more realistic messages
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = INSTA_FILTERS.to_vec();
|
||||
{{#packages}}
|
||||
filters.push((r"{{name}}", "{{cute_name}}"));
|
||||
{{/packages}}
|
||||
filters.push((r"{{name}}-", "pkg-"));
|
||||
filters.push((r"{{name}}-", "package-"));
|
||||
|
||||
let requirements_in = context.temp_dir.child("requirements.in");
|
||||
{{#root.requires}}
|
||||
|
|
|
@ -81,12 +81,9 @@ fn command(context: &TestContext) -> Command {
|
|||
fn {{module_name}}() {
|
||||
let context = TestContext::new("{{environment.python}}");
|
||||
|
||||
// In addition to the standard filters, swap out package names for more realistic messages
|
||||
// In addition to the standard filters, swap out package names for shorter messages
|
||||
let mut filters = INSTA_FILTERS.to_vec();
|
||||
{{#packages}}
|
||||
filters.push((r"{{name}}", "{{cute_name}}"));
|
||||
{{/packages}}
|
||||
filters.push((r"{{name}}-", "pkg-"));
|
||||
filters.push((r"{{name}}-", "package-"));
|
||||
|
||||
uv_snapshot!(filters, command(&context)
|
||||
{{#resolver_options.prereleases}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue