-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Syncing using pre-commit does not update the additional_dependencies properly when multiline used
❯ pre-commit run sync-pre-commit-uv
[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to /root/.cache/pre-commit/patch1764930640-97215.
Sync pre-commit with uv lock.............................................Failed
- hook id: sync-pre-commit-uv
- exit code: 1
Detected pre-commit hooks that can be updated to match the lockfile:
✔ https://github.com/pre-commit/mirrors-mypy
└ mypy
└ numpy 1.26.3 -> 1.26.4
Traceback (most recent call last):
File "/root/.cache/pre-commit/repozc9xtv45/py_env-python3.11/bin/sync-pre-commit-uv", line 7, in <module>
sys.exit(sync_pre_commit())
^^^^^^^^^^^^^^^^^
File "/root/.cache/pre-commit/repozc9xtv45/py_env-python3.11/lib/python3.11/site-packages/sync_pre_commit_lock/uv.py", line 50, in sync_pre_commit
).execute()
^^^^^^^^^
File "/root/.cache/pre-commit/repozc9xtv45/py_env-python3.11/lib/python3.11/site-packages/sync_pre_commit_lock/actions/sync_hooks.py", line 78, in execute
pre_commit_config_data.update_pre_commit_repo_versions(to_fix)
File "/root/.cache/pre-commit/repozc9xtv45/py_env-python3.11/lib/python3.11/site-packages/sync_pre_commit_lock/pre_commit_config.py", line 216, in update_pre_commit_repo_versions
raise RuntimeError(msg)
RuntimeError: No changes to write, this should not happen
[INFO] Restored changes from /root/.cache/pre-commit/patch1764930640-97215.
To Reproduce
Steps to reproduce the behavior:
In uv.lock I have a numpy version 1.26.4
This is my pre-commit-config.yaml:
repos:
- repo: https://github.com/GabDug/sync-pre-commit-lock
rev: v0.8.0
hooks:
- id: sync-pre-commit-uv
always_run: true
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.18.2
hooks:
- id: mypy
additional_dependencies: [
numpy==1.26.3,
]
Expected behavior
Changing numpy to 1.26.4
Screenshots
I checked that you are reporting the same orig line for all dependencies.
In other words, the problem does not exist if you put additional_dependencies in one line.

Desktop (please complete the following information):
- OS: Linux
- Package Manager: uv
- Version: 0.8.0
Additional context
none
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working