From 8545ae2312ffeac5bf6ee433c39770f9f85632d5 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Tue, 30 Jul 2024 15:09:43 -0400 Subject: [PATCH] Rename more use of "lock file" to "lockfile" (#5629) --- crates/uv/tests/workspace.rs | 2 +- docs/concepts/projects.md | 14 +++--- docs/concepts/resolution.md | 2 +- docs/pip/compile.md | 2 +- scripts/benchmark/src/benchmark/resolver.py | 54 ++++++++++----------- 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/crates/uv/tests/workspace.rs b/crates/uv/tests/workspace.rs index 5a800dd1d..edb799108 100644 --- a/crates/uv/tests/workspace.rs +++ b/crates/uv/tests/workspace.rs @@ -573,7 +573,7 @@ fn workspace_lock_idempotence_virtual_workspace() -> Result<()> { Ok(()) } -/// Extract just the sources from the lock file, to test path resolution. +/// Extract just the sources from the lockfile, to test path resolution. #[derive(Deserialize, Serialize)] struct SourceLock { distribution: Vec, diff --git a/docs/concepts/projects.md b/docs/concepts/projects.md index 9f55e4b3d..02a3cfbad 100644 --- a/docs/concepts/projects.md +++ b/docs/concepts/projects.md @@ -46,7 +46,7 @@ When `uv run` is invoked, it will create the project environment if it does not It is _not_ recommended to modify the project environment manually, e.g., with `uv pip install`. For project dependencies, use `uv add` to add a package to the environment. For one-off requirements, use [`uvx`](../guides/tools.md) or [`uv run --with`](#running-commands-with-additional-dependencies). -## Lock file +## Lockfile uv creates a `uv.lock` file next to the `pyproject.toml`. @@ -56,18 +56,18 @@ broad requirements of your project, the lockfile contains the exact resolved ver that are installed in the project environment. This file should be checked into version control, allowing for consistent and reproducible installations across machines. -A "universal" lock file captures packages that would be installed across all possible Python markers such as operating system, architecture, and Python version. +A "universal" lockfile captures packages that would be installed across all possible Python markers such as operating system, architecture, and Python version. -A lock file ensures that developers working on the project are using a consistent set of package versions. Additionally, it ensures when deploying the project as an application that the exact set of used package versions is known. +A lockfile ensures that developers working on the project are using a consistent set of package versions. Additionally, it ensures when deploying the project as an application that the exact set of used package versions is known. -The lock file is created and updated during uv invocations that use the project environment, i.e., `uv sync` and `uv run`. The lock file may also be explicitly updated using `uv lock`. +The lockfile is created and updated during uv invocations that use the project environment, i.e., `uv sync` and `uv run`. The lockfile may also be explicitly updated using `uv lock`. `uv.lock` is a human-readable TOML file but is managed by uv and should not be -edited manually. There is no Python standard for lock files at this time, so the format of this file is specific to uv and not generally not usable by other tools. +edited manually. There is no Python standard for lockfiles at this time, so the format of this file is specific to uv and not generally not usable by other tools. -To avoid updating the lock file during `uv sync` and `uv run` invocations, use the `--frozen` flag. +To avoid updating the lockfile during `uv sync` and `uv run` invocations, use the `--frozen` flag. -To assert the lock file is up to date, use the `--locked` flag. If the lock file is not up to date, an error will be raised instead of updating the lock file. +To assert the lockfile is up to date, use the `--locked` flag. If the lockfile is not up to date, an error will be raised instead of updating the lockfile. ## Managing dependencies diff --git a/docs/concepts/resolution.md b/docs/concepts/resolution.md index 2be42ef14..64f403fac 100644 --- a/docs/concepts/resolution.md +++ b/docs/concepts/resolution.md @@ -117,7 +117,7 @@ will be treated as a lower bound. For example, `--universal --python-version 3.7 for Python 3.7 and later. If using uv's [project](../guides/projects.md) interface, the machine agnostic resolution will be used -automatically and a `uv.lock` file will be created. The lock file can also be created with an explicit `uv lock` +automatically and a `uv.lock` file will be created. The lockfile can also be created with an explicit `uv lock` invocation. uv also supports resolving for specific alternate platforms and Python versions via the diff --git a/docs/pip/compile.md b/docs/pip/compile.md index e33528d3d..6b19c6866 100644 --- a/docs/pip/compile.md +++ b/docs/pip/compile.md @@ -76,7 +76,7 @@ To upgrade all dependencies, there is an `--upgrade` flag. Dependencies can be installed directly from their definition files or from compiled `requirements.txt` files with `uv pip install`. See the documentation on [installing packages from files](packages.md#installing-packages-from-files) for more details. -When installing with `uv pip install`, packages that are already installed will not be removed unless they conflict with the lock file. This means that the environment can have dependencies that aren't declared in the lock file, which isn't great for reproducibility. To ensure the environment exactly matches the lock file, use `uv pip sync` instead. +When installing with `uv pip install`, packages that are already installed will not be removed unless they conflict with the lockfile. This means that the environment can have dependencies that aren't declared in the lockfile, which isn't great for reproducibility. To ensure the environment exactly matches the lockfile, use `uv pip sync` instead. To sync an environment with a `requirements.txt` file: diff --git a/scripts/benchmark/src/benchmark/resolver.py b/scripts/benchmark/src/benchmark/resolver.py index dd5d9dbb8..acbcfa7f2 100644 --- a/scripts/benchmark/src/benchmark/resolver.py +++ b/scripts/benchmark/src/benchmark/resolver.py @@ -218,7 +218,7 @@ class PipCompile(Suite): stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, ) - assert os.path.exists(baseline), f"Lock file doesn't exist at: {baseline}" + assert os.path.exists(baseline), f"Lockfile doesn't exist at: {baseline}" input_file = os.path.join(cwd, "requirements.in") output_file = os.path.join(cwd, "requirements.txt") @@ -261,7 +261,7 @@ class PipCompile(Suite): stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, ) - assert os.path.exists(output_file), f"Lock file doesn't exist at: {output_file}" + assert os.path.exists(output_file), f"Lockfile doesn't exist at: {output_file}" return Command( name=f"{self.name} ({Benchmark.RESOLVE_NOOP.value})", @@ -443,7 +443,7 @@ class Poetry(Suite): poetry_lock = os.path.join(cwd, "poetry.lock") assert not os.path.exists( poetry_lock - ), f"Lock file already exists at: {poetry_lock}" + ), f"Lockfile already exists at: {poetry_lock}" # Run a resolution, to ensure that the lockfile exists. # TODO(charlie): Make this a `setup`. @@ -453,7 +453,7 @@ class Poetry(Suite): stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, ) - assert os.path.exists(poetry_lock), f"Lock file doesn't exist at: {poetry_lock}" + assert os.path.exists(poetry_lock), f"Lockfile doesn't exist at: {poetry_lock}" # Add a dependency to the requirements file. with open(os.path.join(cwd, "pyproject.toml"), "rb") as fp: @@ -499,7 +499,7 @@ class Poetry(Suite): poetry_lock = os.path.join(cwd, "poetry.lock") assert not os.path.exists( poetry_lock - ), f"Lock file already exists at: {poetry_lock}" + ), f"Lockfile already exists at: {poetry_lock}" # Run a resolution, to ensure that the lockfile exists. # TODO(charlie): Make this a `setup`. @@ -509,7 +509,7 @@ class Poetry(Suite): stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, ) - assert os.path.exists(poetry_lock), f"Lock file doesn't exist at: {poetry_lock}" + assert os.path.exists(poetry_lock), f"Lockfile doesn't exist at: {poetry_lock}" config_dir = os.path.join(cwd, "config", "pypoetry") cache_dir = os.path.join(cwd, "cache", "pypoetry") @@ -536,7 +536,7 @@ class Poetry(Suite): poetry_lock = os.path.join(cwd, "poetry.lock") assert not os.path.exists( poetry_lock - ), f"Lock file already exists at: {poetry_lock}" + ), f"Lockfile already exists at: {poetry_lock}" # Run a resolution, to ensure that the lockfile exists. # TODO(charlie): Make this a `setup`. @@ -546,7 +546,7 @@ class Poetry(Suite): stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, ) - assert os.path.exists(poetry_lock), f"Lock file doesn't exist at: {poetry_lock}" + assert os.path.exists(poetry_lock), f"Lockfile doesn't exist at: {poetry_lock}" config_dir = os.path.join(cwd, "config", "pypoetry") cache_dir = os.path.join(cwd, "cache", "pypoetry") @@ -581,7 +581,7 @@ class Poetry(Suite): poetry_lock = os.path.join(cwd, "poetry.lock") assert not os.path.exists( poetry_lock - ), f"Lock file already exists at: {poetry_lock}" + ), f"Lockfile already exists at: {poetry_lock}" # Run a resolution, to ensure that the lockfile exists. subprocess.check_call( @@ -590,7 +590,7 @@ class Poetry(Suite): stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, ) - assert os.path.exists(poetry_lock), f"Lock file doesn't exist at: {poetry_lock}" + assert os.path.exists(poetry_lock), f"Lockfile doesn't exist at: {poetry_lock}" config_dir = os.path.join(cwd, "config", "pypoetry") cache_dir = os.path.join(cwd, "cache", "pypoetry") @@ -697,7 +697,7 @@ class Pdm(Suite): self.setup(requirements_file, cwd=cwd) pdm_lock = os.path.join(cwd, "pdm.lock") - assert not os.path.exists(pdm_lock), f"Lock file already exists at: {pdm_lock}" + assert not os.path.exists(pdm_lock), f"Lockfile already exists at: {pdm_lock}" # Run a resolution, to ensure that the lockfile exists. # TODO(charlie): Make this a `setup`. @@ -707,7 +707,7 @@ class Pdm(Suite): stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, ) - assert os.path.exists(pdm_lock), f"Lock file doesn't exist at: {pdm_lock}" + assert os.path.exists(pdm_lock), f"Lockfile doesn't exist at: {pdm_lock}" # Add a dependency to the requirements file. with open(os.path.join(cwd, "pyproject.toml"), "rb") as fp: @@ -742,7 +742,7 @@ class Pdm(Suite): self.setup(requirements_file, cwd=cwd) pdm_lock = os.path.join(cwd, "pdm.lock") - assert not os.path.exists(pdm_lock), f"Lock file already exists at: {pdm_lock}" + assert not os.path.exists(pdm_lock), f"Lockfile already exists at: {pdm_lock}" # Run a resolution, to ensure that the lockfile exists. # TODO(charlie): Make this a `setup`. @@ -752,7 +752,7 @@ class Pdm(Suite): stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, ) - assert os.path.exists(pdm_lock), f"Lock file doesn't exist at: {pdm_lock}" + assert os.path.exists(pdm_lock), f"Lockfile doesn't exist at: {pdm_lock}" cache_dir = os.path.join(cwd, "cache", "pdm") @@ -772,7 +772,7 @@ class Pdm(Suite): self.setup(requirements_file, cwd=cwd) pdm_lock = os.path.join(cwd, "pdm.lock") - assert not os.path.exists(pdm_lock), f"Lock file already exists at: {pdm_lock}" + assert not os.path.exists(pdm_lock), f"Lockfile already exists at: {pdm_lock}" # Run a resolution, to ensure that the lockfile exists. # TODO(charlie): Make this a `setup`. @@ -782,7 +782,7 @@ class Pdm(Suite): stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, ) - assert os.path.exists(pdm_lock), f"Lock file doesn't exist at: {pdm_lock}" + assert os.path.exists(pdm_lock), f"Lockfile doesn't exist at: {pdm_lock}" venv_dir = os.path.join(cwd, ".venv") cache_dir = os.path.join(cwd, "cache", "pdm") @@ -807,7 +807,7 @@ class Pdm(Suite): self.setup(requirements_file, cwd=cwd) pdm_lock = os.path.join(cwd, "pdm.lock") - assert not os.path.exists(pdm_lock), f"Lock file already exists at: {pdm_lock}" + assert not os.path.exists(pdm_lock), f"Lockfile already exists at: {pdm_lock}" # Run a resolution, to ensure that the lockfile exists. # TODO(charlie): Make this a `setup`. @@ -817,7 +817,7 @@ class Pdm(Suite): stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, ) - assert os.path.exists(pdm_lock), f"Lock file doesn't exist at: {pdm_lock}" + assert os.path.exists(pdm_lock), f"Lockfile doesn't exist at: {pdm_lock}" venv_dir = os.path.join(cwd, ".venv") cache_dir = os.path.join(cwd, "cache", "pdm") @@ -916,7 +916,7 @@ class UvPip(Suite): stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, ) - assert os.path.exists(baseline), f"Lock file doesn't exist at: {baseline}" + assert os.path.exists(baseline), f"Lockfile doesn't exist at: {baseline}" input_file = os.path.join(cwd, "requirements.in") output_file = os.path.join(cwd, "requirements.txt") @@ -1107,7 +1107,7 @@ class UvProject(Suite): self.setup(requirements_file, cwd=cwd) uv_lock = os.path.join(cwd, "uv.lock") - assert not os.path.exists(uv_lock), f"Lock file already exists at: {uv_lock}" + assert not os.path.exists(uv_lock), f"Lockfile already exists at: {uv_lock}" # Run a resolution, to ensure that the lockfile exists. # TODO(charlie): Make this a `setup`. @@ -1117,7 +1117,7 @@ class UvProject(Suite): stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, ) - assert os.path.exists(uv_lock), f"Lock file doesn't exist at: {uv_lock}" + assert os.path.exists(uv_lock), f"Lockfile doesn't exist at: {uv_lock}" # Add a dependency to the requirements file. with open(os.path.join(cwd, "pyproject.toml"), "rb") as fp: @@ -1155,7 +1155,7 @@ class UvProject(Suite): self.setup(requirements_file, cwd=cwd) uv_lock = os.path.join(cwd, "uv.lock") - assert not os.path.exists(uv_lock), f"Lock file already exists at: {uv_lock}" + assert not os.path.exists(uv_lock), f"Lockfile already exists at: {uv_lock}" # Run a resolution, to ensure that the lockfile exists. # TODO(charlie): Make this a `setup`. @@ -1165,7 +1165,7 @@ class UvProject(Suite): stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, ) - assert os.path.exists(uv_lock), f"Lock file doesn't exist at: {uv_lock}" + assert os.path.exists(uv_lock), f"Lockfile doesn't exist at: {uv_lock}" cache_dir = os.path.join(cwd, ".cache") @@ -1188,7 +1188,7 @@ class UvProject(Suite): self.setup(requirements_file, cwd=cwd) uv_lock = os.path.join(cwd, "uv.lock") - assert not os.path.exists(uv_lock), f"Lock file already exists at: {uv_lock}" + assert not os.path.exists(uv_lock), f"Lockfile already exists at: {uv_lock}" # Run a resolution, to ensure that the lockfile exists. # TODO(charlie): Make this a `setup`. @@ -1198,7 +1198,7 @@ class UvProject(Suite): stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, ) - assert os.path.exists(uv_lock), f"Lock file doesn't exist at: {uv_lock}" + assert os.path.exists(uv_lock), f"Lockfile doesn't exist at: {uv_lock}" cache_dir = os.path.join(cwd, ".cache") venv_dir = os.path.join(cwd, ".venv") @@ -1226,7 +1226,7 @@ class UvProject(Suite): self.setup(requirements_file, cwd=cwd) uv_lock = os.path.join(cwd, "uv.lock") - assert not os.path.exists(uv_lock), f"Lock file already exists at: {uv_lock}" + assert not os.path.exists(uv_lock), f"Lockfile already exists at: {uv_lock}" # Run a resolution, to ensure that the lockfile exists. # TODO(charlie): Make this a `setup`. @@ -1236,7 +1236,7 @@ class UvProject(Suite): stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, ) - assert os.path.exists(uv_lock), f"Lock file doesn't exist at: {uv_lock}" + assert os.path.exists(uv_lock), f"Lockfile doesn't exist at: {uv_lock}" cache_dir = os.path.join(cwd, ".cache") venv_dir = os.path.join(cwd, ".venv")