File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616 pre-commit hook. This is mainly useful for hooks that need a complete environment to
1717 run, like static type checkers (` mypy ` , ` pyright ` , etc.).
1818
19+ ## What?
20+
21+ If your ` .pre-commit-config.yaml ` file looks like this:
22+ ``` yaml
23+ - repo : https://github.com/astral-sh/ruff-pre-commit
24+ rev : v0.11.11
25+ hooks :
26+ - id : ruff
27+ ` ` `
28+ but your ` uv.lock` says you're using ruff at version `0.12.0`, then the hook will change
29+ `.pre-commit-config.yaml` to :
30+ ` ` ` diff
31+ - repo: https://github.com/astral-sh/ruff-pre-commit
32+ - rev: v0.11.11
33+ + rev: v0.12.0
34+ hooks:
35+ - id: ruff
36+ ` ` `
37+
38+ And if it looks like this :
39+ ` ` ` yaml
40+ - repo: https://github.com/RobertCraigie/pyright-python
41+ rev: v1.1.400
42+ hooks:
43+ - id: pyright
44+ additional_dependencies:
45+ - django-stubs==5.1.3
46+ ` ` `
47+ And you've added configuration in `pyproject.toml` to synchronize the
48+ `additional_dependencies` with the uv dependency group named `types` :
49+ ` ` ` toml
50+ [tool.sync-pre-commit-with-uv.pyright-python]
51+ pypi_package_name = "pyright"
52+ additional_dependencies_uv_params = ["--group", "types"]
53+ ` ` `
54+ Then when uv upgrades `django-stubs` to 5.1.4, the hook will upgrade
55+ `.pre-commit-config.yaml` to :
56+ ` ` ` diff
57+ - repo: https://github.com/RobertCraigie/pyright-python
58+ rev: v1.1.400
59+ hooks:
60+ - id: pyright
61+ additional_dependencies:
62+ - - django-stubs==5.1.3
63+ + - django-stubs==5.1.4
64+ ` ` `
65+
66+
1967# # Installation & Usage
2068
2169` ` ` yaml
You can’t perform that action at this time.
0 commit comments