Skip to content

Commit

Permalink
Rename environment-markers to resolution-markers (#6240)
Browse files Browse the repository at this point in the history
## Summary

I probably won't land #6210 for the
release, but I do want to make one breaking change to prep for it:
renaming `environment-markers` to `resolution-markers` (or
`solution-markers`?) so that it's delineated from the user-defined
markers in that PR.
  • Loading branch information
charliermarsh authored Aug 20, 2024
1 parent 422730d commit d02c202
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 132 deletions.
10 changes: 5 additions & 5 deletions crates/uv-resolver/src/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ impl Lock {
.filter_map(MarkerTree::contents)
.map(|marker| marker.to_string()),
);
doc.insert("environment-markers", value(fork_markers));
doc.insert("resolution-markers", value(fork_markers));
}

// Write the settings that were used to generate the resolution.
Expand Down Expand Up @@ -949,7 +949,7 @@ struct LockWire {
requires_python: Option<RequiresPython>,
/// If this lockfile was built from a forking resolution with non-identical forks, store the
/// forks in the lockfile so we can recreate them in subsequent resolutions.
#[serde(rename = "environment-markers", default)]
#[serde(rename = "resolution-markers", default)]
fork_markers: Vec<MarkerTree>,
/// We discard the lockfile if these options match.
#[serde(default)]
Expand Down Expand Up @@ -1019,7 +1019,7 @@ pub struct Package {
/// the fork(s) that contained this version or source, so we can set the correct preferences in
/// the next resolution.
///
/// Named `environment-markers` in `uv.lock`.
/// Named `resolution-markers` in `uv.lock`.
fork_markers: Vec<MarkerTree>,
/// The resolved dependencies of the package.
dependencies: Vec<Dependency>,
Expand Down Expand Up @@ -1326,7 +1326,7 @@ impl Package {
.filter_map(MarkerTree::contents)
.map(|marker| marker.to_string()),
);
table.insert("environment-markers", value(wheels));
table.insert("resolution-markers", value(wheels));
}

if !self.dependencies.is_empty() {
Expand Down Expand Up @@ -1536,7 +1536,7 @@ struct PackageWire {
sdist: Option<SourceDist>,
#[serde(default)]
wheels: Vec<Wheel>,
#[serde(default, rename = "environment-markers")]
#[serde(default, rename = "resolution-markers")]
fork_markers: Vec<MarkerTree>,
#[serde(default)]
dependencies: Vec<DependencyWire>,
Expand Down
32 changes: 16 additions & 16 deletions crates/uv/tests/branching_urls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ fn root_package_splits_transitive_too() -> Result<()> {
assert_snapshot!(fs_err::read_to_string(context.temp_dir.join("uv.lock"))?, @r###"
version = 1
requires-python = ">=3.11, <3.13"
environment-markers = [
resolution-markers = [
"python_full_version < '3.12'",
"python_full_version >= '3.12'",
]
Expand Down Expand Up @@ -237,7 +237,7 @@ fn root_package_splits_transitive_too() -> Result<()> {
name = "anyio"
version = "4.2.0"
source = { registry = "https://pypi.org/simple" }
environment-markers = [
resolution-markers = [
"python_full_version < '3.12'",
]
dependencies = [
Expand All @@ -253,7 +253,7 @@ fn root_package_splits_transitive_too() -> Result<()> {
name = "anyio"
version = "4.3.0"
source = { registry = "https://pypi.org/simple" }
environment-markers = [
resolution-markers = [
"python_full_version >= '3.12'",
]
dependencies = [
Expand Down Expand Up @@ -315,7 +315,7 @@ fn root_package_splits_transitive_too() -> Result<()> {
name = "iniconfig"
version = "1.1.1"
source = { url = "https://files.pythonhosted.org/packages/9b/dd/b3c12c6d707058fa947864b67f0c4e0c39ef8610988d7baea9578f3c48f3/iniconfig-1.1.1-py2.py3-none-any.whl" }
environment-markers = [
resolution-markers = [
"python_full_version < '3.12'",
]
wheels = [
Expand All @@ -326,7 +326,7 @@ fn root_package_splits_transitive_too() -> Result<()> {
name = "iniconfig"
version = "2.0.0"
source = { url = "https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl" }
environment-markers = [
resolution-markers = [
"python_full_version >= '3.12'",
]
wheels = [
Expand Down Expand Up @@ -403,7 +403,7 @@ fn root_package_splits_other_dependencies_too() -> Result<()> {
assert_snapshot!(fs_err::read_to_string(context.temp_dir.join("uv.lock"))?, @r###"
version = 1
requires-python = ">=3.11, <3.13"
environment-markers = [
resolution-markers = [
"python_full_version < '3.12'",
"python_full_version >= '3.12'",
]
Expand Down Expand Up @@ -434,7 +434,7 @@ fn root_package_splits_other_dependencies_too() -> Result<()> {
name = "anyio"
version = "4.2.0"
source = { registry = "https://pypi.org/simple" }
environment-markers = [
resolution-markers = [
"python_full_version < '3.12'",
]
dependencies = [
Expand All @@ -450,7 +450,7 @@ fn root_package_splits_other_dependencies_too() -> Result<()> {
name = "anyio"
version = "4.3.0"
source = { registry = "https://pypi.org/simple" }
environment-markers = [
resolution-markers = [
"python_full_version >= '3.12'",
]
dependencies = [
Expand Down Expand Up @@ -497,7 +497,7 @@ fn root_package_splits_other_dependencies_too() -> Result<()> {
name = "iniconfig"
version = "1.1.1"
source = { registry = "https://pypi.org/simple" }
environment-markers = [
resolution-markers = [
"python_full_version < '3.12'",
]
sdist = { url = "https://files.pythonhosted.org/packages/23/a2/97899f6bd0e873fed3a7e67ae8d3a08b21799430fb4da15cfedf10d6e2c2/iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32", size = 8104 }
Expand All @@ -509,7 +509,7 @@ fn root_package_splits_other_dependencies_too() -> Result<()> {
name = "iniconfig"
version = "2.0.0"
source = { registry = "https://pypi.org/simple" }
environment-markers = [
resolution-markers = [
"python_full_version >= '3.12'",
]
sdist = { url = "https://files.pythonhosted.org/packages/d7/4b/cbd8e699e64a6f16ca3a8220661b5f83792b3017d0f79807cb8708d33913/iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3", size = 4646 }
Expand Down Expand Up @@ -564,7 +564,7 @@ fn branching_between_registry_and_direct_url() -> Result<()> {
assert_snapshot!(fs_err::read_to_string(context.temp_dir.join("uv.lock"))?, @r###"
version = 1
requires-python = ">=3.11, <3.13"
environment-markers = [
resolution-markers = [
"python_full_version < '3.12'",
"python_full_version >= '3.12'",
]
Expand All @@ -591,7 +591,7 @@ fn branching_between_registry_and_direct_url() -> Result<()> {
name = "iniconfig"
version = "1.1.1"
source = { registry = "https://pypi.org/simple" }
environment-markers = [
resolution-markers = [
"python_full_version < '3.12'",
]
sdist = { url = "https://files.pythonhosted.org/packages/23/a2/97899f6bd0e873fed3a7e67ae8d3a08b21799430fb4da15cfedf10d6e2c2/iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32", size = 8104 }
Expand All @@ -603,7 +603,7 @@ fn branching_between_registry_and_direct_url() -> Result<()> {
name = "iniconfig"
version = "2.0.0"
source = { url = "https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl" }
environment-markers = [
resolution-markers = [
"python_full_version >= '3.12'",
]
wheels = [
Expand Down Expand Up @@ -649,7 +649,7 @@ fn branching_urls_of_different_sources_disjoint() -> Result<()> {
assert_snapshot!(fs_err::read_to_string(context.temp_dir.join("uv.lock"))?, @r###"
version = 1
requires-python = ">=3.11, <3.13"
environment-markers = [
resolution-markers = [
"python_full_version < '3.12'",
"python_full_version >= '3.12'",
]
Expand All @@ -676,7 +676,7 @@ fn branching_urls_of_different_sources_disjoint() -> Result<()> {
name = "iniconfig"
version = "1.1.1"
source = { url = "https://files.pythonhosted.org/packages/9b/dd/b3c12c6d707058fa947864b67f0c4e0c39ef8610988d7baea9578f3c48f3/iniconfig-1.1.1-py2.py3-none-any.whl" }
environment-markers = [
resolution-markers = [
"python_full_version < '3.12'",
]
wheels = [
Expand All @@ -687,7 +687,7 @@ fn branching_urls_of_different_sources_disjoint() -> Result<()> {
name = "iniconfig"
version = "2.0.0"
source = { git = "https://github.com/pytest-dev/iniconfig?rev=93f5930e668c0d1ddf4597e38dd0dea4e2665e7a#93f5930e668c0d1ddf4597e38dd0dea4e2665e7a" }
environment-markers = [
resolution-markers = [
"python_full_version >= '3.12'",
]
"###);
Expand Down
28 changes: 14 additions & 14 deletions crates/uv/tests/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1610,7 +1610,7 @@ fn lock_conditional_dependency_extra() -> Result<()> {
lock, @r###"
version = 1
requires-python = ">=3.7"
environment-markers = [
resolution-markers = [
"python_full_version < '3.10'",
"python_full_version >= '3.10'",
]
Expand Down Expand Up @@ -2251,7 +2251,7 @@ fn lock_upgrade_log_multi_version() -> Result<()> {
lock, @r###"
version = 1
requires-python = ">=3.12"
environment-markers = [
resolution-markers = [
"sys_platform != 'win32'",
"sys_platform == 'win32'",
]
Expand All @@ -2263,7 +2263,7 @@ fn lock_upgrade_log_multi_version() -> Result<()> {
name = "markupsafe"
version = "1.1.1"
source = { registry = "https://pypi.org/simple" }
environment-markers = [
resolution-markers = [
"sys_platform != 'win32'",
]
sdist = { url = "https://files.pythonhosted.org/packages/b9/2e/64db92e53b86efccfaea71321f597fa2e1b2bd3853d8ce658568f7a13094/MarkupSafe-1.1.1.tar.gz", hash = "sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b", size = 19151 }
Expand All @@ -2272,7 +2272,7 @@ fn lock_upgrade_log_multi_version() -> Result<()> {
name = "markupsafe"
version = "2.0.0"
source = { registry = "https://pypi.org/simple" }
environment-markers = [
resolution-markers = [
"sys_platform == 'win32'",
]
sdist = { url = "https://files.pythonhosted.org/packages/67/6a/5b3ed5c122e20c33d2562df06faf895a6b91b0a6b96a4626440ffe1d5c8e/MarkupSafe-2.0.0.tar.gz", hash = "sha256:4fae0677f712ee090721d8b17f412f1cbceefbf0dc180fe91bab3232f38b4527", size = 18466 }
Expand Down Expand Up @@ -3710,7 +3710,7 @@ fn lock_python_version_marker_complement() -> Result<()> {
lock, @r###"
version = 1
requires-python = ">=3.8"
environment-markers = [
resolution-markers = [
"python_full_version < '3.10'",
"python_full_version == '3.10'",
"python_full_version > '3.10' and python_full_version < '3.11'",
Expand Down Expand Up @@ -5041,7 +5041,7 @@ fn lock_same_version_multiple_urls() -> Result<()> {
lock, @r###"
version = 1
requires-python = ">=3.12"
environment-markers = [
resolution-markers = [
"sys_platform == 'darwin'",
"sys_platform != 'darwin'",
]
Expand All @@ -5053,7 +5053,7 @@ fn lock_same_version_multiple_urls() -> Result<()> {
name = "anyio"
version = "3.0.0"
source = { registry = "https://pypi.org/simple" }
environment-markers = [
resolution-markers = [
"sys_platform != 'darwin'",
]
dependencies = [
Expand All @@ -5069,7 +5069,7 @@ fn lock_same_version_multiple_urls() -> Result<()> {
name = "anyio"
version = "3.7.0"
source = { registry = "https://pypi.org/simple" }
environment-markers = [
resolution-markers = [
"sys_platform == 'darwin'",
]
dependencies = [
Expand All @@ -5085,7 +5085,7 @@ fn lock_same_version_multiple_urls() -> Result<()> {
name = "dependency"
version = "0.0.1"
source = { directory = "[TEMP_DIR]/v1" }
environment-markers = [
resolution-markers = [
"sys_platform == 'darwin'",
]
dependencies = [
Expand All @@ -5099,7 +5099,7 @@ fn lock_same_version_multiple_urls() -> Result<()> {
name = "dependency"
version = "0.0.1"
source = { directory = "[TEMP_DIR]/v2" }
environment-markers = [
resolution-markers = [
"sys_platform != 'darwin'",
]
dependencies = [
Expand Down Expand Up @@ -6440,7 +6440,7 @@ fn lock_upgrade_drop_fork_markers() -> Result<()> {
.assert()
.success();
let lock = fs_err::read_to_string(context.temp_dir.join("uv.lock")).unwrap();
assert!(lock.contains("environment-markers"));
assert!(lock.contains("resolution-markers"));

// Remove the bound and lock with `--upgrade`.
pyproject_toml.write_str(&requirements.replace("fork-upgrade-foo==1", "fork-upgrade-foo"))?;
Expand All @@ -6453,7 +6453,7 @@ fn lock_upgrade_drop_fork_markers() -> Result<()> {
.assert()
.success();
let lock = fs_err::read_to_string(context.temp_dir.join("uv.lock")).unwrap();
assert!(!lock.contains("environment-markers"));
assert!(!lock.contains("resolution-markers"));
Ok(())
}

Expand Down Expand Up @@ -9744,7 +9744,7 @@ fn lock_narrowed_python_version() -> Result<()> {
lock, @r###"
version = 1
requires-python = ">=3.7"
environment-markers = [
resolution-markers = [
"python_full_version < '3.9'",
"python_full_version >= '3.9' and python_full_version < '3.11'",
"python_full_version >= '3.11'",
Expand Down Expand Up @@ -9849,7 +9849,7 @@ fn lock_exclude_unnecessary_python_forks() -> Result<()> {
lock, @r###"
version = 1
requires-python = ">=3.12"
environment-markers = [
resolution-markers = [
"sys_platform == 'darwin'",
"sys_platform != 'darwin'",
]
Expand Down
Loading

0 comments on commit d02c202

Please sign in to comment.