Important
After realizing astral-sh/uv-pre-commit-hook already provides the same functionality, I have decided to deprecate this repository. Please use the mentioned tool instead.
A pre-commit hook to validate pyproject.toml and uv.lock files are in sync
Add the hook to your .pre-commit-config.yaml:
- repo: https://github.com/ulgens/uv-lock-check
rev: v0.1.0
hooks:
- id: uv-lock-check
language: python
additional_dependencies:
- uv==0.9.26additional_dependencies definition is optional, but I recommend to match the uv version to your project's uv version, to ensure consistent results. language: python is necessary only if you want to make use of additional_dependencies and Renovate to update the dependency automatically: https://docs.renovatebot.com/modules/manager/pre-commit/#additional-dependencies
The original inline version of this hook was created with the help of https://til.unessa.net/git/pre-commit-hook/
This repo solves a very specific need, and I can't think of what could be added or improved. If you can think of any, please feel free to open an issue or a pull request.
- https://github.com/hbelmiro/uv-lock-check - A GitHub Action that validates if your uv.lock file and optionally requirements.txt files are in sync with your pyproject.toml file.
This repo is maintained as part of my ongoing work with CI tools. If your organization needs help with
- CI/CD pipeline design/improvements
- Dependency management automation
- Code quality and linting standards
- Backend development best practices
or other sort of assistance with a Python project, I'm available for consulting engagements. Connect with me on LinkedIn and let's discover how I can help your team succeed!