diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7cf3a66e8a..c7eee945cf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -70,3 +70,11 @@ repos: rev: v2.4.1 hooks: - id: codespell + - repo: local + hooks: + - id: uv-lock-check + name: uv lock file check + entry: make uv-lock-check + language: system + pass_filenames: false + files: ^(pyproject\.toml|uv\.lock)$ diff --git a/Makefile b/Makefile index 910e9d919f..aad429008e 100644 --- a/Makefile +++ b/Makefile @@ -168,3 +168,11 @@ clean: ## Remove build artifacts and caches @find . -name "*.pyd" -exec echo Deleting {} \; -delete @find . -name "*.pyo" -exec echo Deleting {} \; -delete @echo "Cleanup complete." + +uv-lock: ## Regenerate uv.lock file from pyproject.toml + uv lock $(PYTHON_ARG) + +uv-lock-check: ## Verify uv.lock is up to date + @command -v uv >/dev/null || \ + (echo "uv is required. Run 'make install' or 'make install-uv' first." && exit 1) + uv lock --check $(PYTHON_ARG) diff --git a/mkdocs/docs/contributing.md b/mkdocs/docs/contributing.md index 9278d33a82..858d47aa0e 100644 --- a/mkdocs/docs/contributing.md +++ b/mkdocs/docs/contributing.md @@ -90,6 +90,23 @@ For full control over your environment, you can use uv commands directly. See th - Running commands with `uv run` - Lock file management with `uv.lock` +### Lock File Management + +`uv.lock` is a cross-platform lockfile that contains exact information about the project's dependencies. +See the [uv.lock documentation](https://docs.astral.sh/uv/guides/projects/#uvlock) for more details. + +When modifying dependencies in `pyproject.toml`, regenerate the lock file: + +```bash +make uv-lock +``` + +Separately, to verify that the lock file is up to date without modifying it: + +```bash +make uv-lock-check +``` + ## Installation from source Clone the repository for local development: