Skip to content

Commit 37739c4

Browse files
n-thumanngreenbonebot
authored andcommitted
Change: Update documentation
1 parent fe57e13 commit 37739c4

File tree

4 files changed

+59
-5
lines changed

4 files changed

+59
-5
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ autohooks:
9696
* `pythonpath` for dependency management via [pip]
9797
* `poetry` for dependency management via [poetry] (recommended)
9898
* `pipenv` for dependency management via [pipenv]
99+
* `uv` for dependency management via [uv]
99100

100101
These modes handle how autohooks, the plugins and their dependencies are loaded
101102
during git hook execution.
@@ -165,3 +166,4 @@ Licensed under the [GNU General Public License v3.0 or later](LICENSE).
165166
[poetry]: https://python-poetry.org/
166167
[pylint]: https://pylint.readthedocs.io/en/latest/
167168
[ruff]: https://docs.astral.sh/ruff/
169+
[uv]: https://docs.astral.sh/uv/

docs/configuration.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ and to set python modules to be run as [autohooks plugins](./plugins).
1111
## Mode Configuration
1212

1313
The mode can be set by adding a `mode =` line to the *pyproject.toml* file.
14-
Current possible options are `"pythonpath"`, `"pipenv"` and `"poetry"` (see
14+
Current possible options are `"pythonpath"`, `"pipenv"`, `"poetry"` and `"uv"`(see
1515
[autohooks mode](./modes)). If the mode setting is missing, the `pythonpath`
1616
mode is used.
1717

@@ -40,6 +40,13 @@ mode = "pythonpath"
4040
```
4141
````
4242
43+
````{group-tab} uv
44+
```toml
45+
[tool.autohooks]
46+
mode = "uv"
47+
```
48+
````
49+
4350
`````
4451

4552
Calling `autohooks activate` also allows for overriding the [mode](./modes)
@@ -66,6 +73,12 @@ autohooks activate --mode pythonpath --force
6673
```
6774
````
6875
76+
````{group-tab} uv
77+
```bash
78+
autohooks activate --mode uv --force
79+
```
80+
````
81+
6982
`````
7083

7184
Please keep in mind that autohooks will always issue a warning if the mode used
@@ -110,4 +123,10 @@ autohooks plugins add autohooks.plugins.pylint
110123
```
111124
````
112125
126+
````{group-tab} uv
127+
```bash
128+
uv run autohooks plugins add autohooks.plugins.pylint
129+
```
130+
````
131+
113132
`````

docs/installation.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ For fulfilling these steps different tooling can be used. Most prominent and cur
1111
* [poetry]
1212
* [pipenv]
1313
* [pip]
14+
* [uv]
1415

1516
```{note}
1617
Using [poetry] is recommended for installing and maintaining autohooks.
@@ -56,6 +57,14 @@ To install autohooks globally for the current user run
5657
python3 -m pip install --user autohooks
5758
```
5859
`````
60+
61+
`````{group-tab} uv
62+
To install autohooks as a development dependency run
63+
64+
```{code-block}
65+
uv add --dev autohooks
66+
```
67+
`````
5968
``````
6069

6170
## 2. Activating the Git Hook
@@ -82,6 +91,12 @@ pipenv run autohooks activate --mode pipenv
8291
autohooks activate --mode pythonpath
8392
```
8493
````
94+
95+
````{group-tab} uv
96+
```bash
97+
uv run autohooks activate --mode uv
98+
```
99+
````
85100
`````
86101

87102
## 3. Installing and Configuring the Plugins to Be Run
@@ -111,7 +126,15 @@ python3 -m pip install --user autohooks-plugin-pylint
111126
autohooks plugins add autohooks.plugins.pylint
112127
```
113128
````
129+
130+
````{group-tab} uv
131+
```bash
132+
uv add --dev autohooks-plugin-pylint
133+
uv run autohooks plugins add autohooks.plugins.pylint
134+
```
135+
````
114136
`````
115137
[pipenv]: https://pipenv.readthedocs.io/en/latest/
116138
[poetry]: https://python-poetry.org/
117139
[pip]: https://pip.pypa.io/en/stable/
140+
[uv]: https://docs.astral.sh/uv/

docs/modes.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Currently three modes for using autohooks are supported:
55
* `pythonpath`
66
* `poetry`
77
* `pipenv`
8+
* `uv`
89

910
These modes handle how autohooks, the plugins and their dependencies are loaded
1011
during git hook execution.
@@ -14,13 +15,13 @@ and no mode is set during [activation](./installation.md), autohooks
1415
will use the [pythonpath mode](#pythonpath-mode) by default.
1516

1617
```{note}
17-
`poetry` or `pipenv` modes leverage the `/usr/bin/env` command using the
18+
`poetry`, `pipenv` or `uv` modes leverage the `/usr/bin/env` command using the
1819
`--split-string` (`-S`) option. If `autohooks` detects that it is
1920
running on an OS where `/usr/bin/env` is yet to support _split_strings_
2021
(notably ubuntu < 19.x), `autohooks` will automatically change to an
21-
internally chosen `poetry_multiline`/`pipenv_mutliline` mode. The
22+
internally chosen `poetry_multiline`/`pipenv_mutliline`/`uv_multiline` mode. The
2223
'multiline' modes *should not* be user-configured options; setting your
23-
project to use `poetry` or `pipenv`allows team members the greatest
24+
project to use `poetry`, `pipenv` or `uv` allows team members the greatest
2425
latitude to use an OS of their choice yet leverage the sane
2526
`/usr/bin/env --split-string` if possible. Though `poetry_multiline`
2627
would generally work for all, it is very confusing sorcery.
@@ -44,7 +45,7 @@ this mode with a virtual environment is that [activating the environment](https:
4445
has to be done manually.
4546

4647
To benefit from the advantages of a virtual environment a much better choice is
47-
to use [poetry] or [pipenv] for managing the virtual environment automatically.
48+
to use [poetry], [pipenv] or [uv] for managing the virtual environment automatically.
4849

4950
## Poetry Mode
5051

@@ -67,5 +68,14 @@ installation is deterministic and reliable between different developer setups.
6768
In contrast to the `pythonpath` mode the activation of the virtual environment
6869
provided by [pipenv] is done automatically in the background.
6970

71+
## uv Mode
72+
73+
With the `uv` mode it is possible to run autohooks in a
74+
dedicated environment controlled by [uv]. By using the `uv` mode the
75+
virtual environment will be activated automatically in the background when
76+
executing the autohooks based git commit hook. All dependencies are managed
77+
by uv using the `pyproject.toml` and `uv.lock` files.
78+
7079
[pipenv]: https://pipenv.readthedocs.io/en/latest/
7180
[poetry]: https://python-poetry.org/
81+
[uv]: https://docs.astral.sh/uv/

0 commit comments

Comments
 (0)