Skip to content

Commit ebd433b

Browse files
Update docs/cli/reference.md: add usethis hook section and rename --pre-commit to --hook
Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com> Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/fdd7c3d5-e514-44f7-a799-5ec619a872f5
1 parent 624d5f7 commit ebd433b

1 file changed

Lines changed: 28 additions & 2 deletions

File tree

docs/cli/reference.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Initialize a new Python project with recommended defaults, including:
77
- a `pyproject.toml` file and relevant configuration,
88
- recommended linters, formatters, spellcheckers, type checkers, and test frameworks (all opt-out),
99
- docstring style enforcement (opt-in),
10-
- the pre-commit framework (opt-in),
10+
- a recommended git hook framework (opt-in),
1111
- CI services (opt-in),
1212
- declared & installed dependencies via `uv add`, and
1313
- any other relevant directories or tool-bespoke configuration files.
@@ -21,7 +21,7 @@ Supported options:
2121
- `--spellcheck` to add a recommended spellchecker (default; or `--no-spellcheck` to opt-out)
2222
- `--test` to add a recommended testing framework (default; or `--no-test` to opt-out)
2323
- `--typecheck` to add a recommended type checker (default; or `--no-typecheck` to opt-out)
24-
- `--pre-commit` to add the pre-commit framework for git hooks (but the default is `--no-pre-commit`)
24+
- `--hook` to add a recommended git hook framework (but the default is `--no-hook`)
2525
- `--ci` to add a CI service configuration
2626

2727
Possible values:
@@ -124,6 +124,32 @@ Supported options:
124124

125125
See [`usethis tool`](#usethis-tool) for more information.
126126

127+
## `usethis hook`
128+
129+
Add a recommended git hook framework to the project (namely, [pre-commit](https://github.com/pre-commit/pre-commit)), including:
130+
131+
- declared & installed dependencies via `uv add`,
132+
- relevant configuration, and
133+
- any other relevant directories or tool-bespoke configuration files.
134+
135+
Note if `pyproject.toml` is not present, it will be created, since this is required for declaring dependencies via `uv add`.
136+
137+
Supported options:
138+
139+
- `--remove` to remove the tool instead of adding it
140+
- `--how` to only print how to use the tool, with no other side effects
141+
- `--offline` to disable network access and rely on caches
142+
- `--frozen` to leave the virtual environment and lockfile unchanged
143+
- `--quiet` to suppress output
144+
- `--backend` to specify a package manager backend to use. The default is to auto-detect.
145+
146+
Possible values:
147+
- `auto` to auto-detect the backend (default)
148+
- `uv` to use the [uv](https://docs.astral.sh/uv) package manager
149+
- `none` to not use a package manager backend and display messages for some operations.
150+
151+
See [`usethis tool`](#usethis-tool) for more information.
152+
127153
## `usethis lint`
128154

129155
Add recommended linters to the project (namely, [Ruff](https://docs.astral.sh/ruff/linter) and [deptry](https://github.com/fpgmaas/deptry)), including:

0 commit comments

Comments
 (0)