Skip to content

Commit 2134a7e

Browse files
committed
Documentation for julia hooks
See pre-commit PR: pre-commit/pre-commit#3348
1 parent 0e459e7 commit 2134a7e

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

sections/new-hooks.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -332,15 +332,22 @@ installed. It has been tested on linux, macOS, and windows.
332332
333333
### julia
334334
335-
_new in 4.x.0_
336-
337-
The hook repository must contain a `Project.toml` file and optionally a `Manifest.toml`
338-
file. Hooks will run in this environment.
335+
_new in 4.1.0_
339336
340337
For configuring julia hooks, your [`entry`](#hooks-entry) should be a path to a julia source
341338
file relative to the hook repository (optionally with arguments).
342339
343-
For example:
340+
Hooks run in an isolated package environment defined by a `Project.toml` file (optionally
341+
with a `Manifest.toml` file) in the hook repository. If no `Project.toml` file is found the
342+
hook is run in an empty environment.
343+
344+
Julia hooks support [`additional_dependencies`](#config-additional_dependencies) which can
345+
be used to augment, or override, the existing environment in the hooks repository. This also
346+
means that julia can be used as a `repo: local` hook. `additional_dependencies` are passed
347+
to `pkg> add` and should be specified using
348+
[Pkg REPL mode syntax](https://pkgdocs.julialang.org/v1/repl/#repl-add).
349+
350+
Examples:
344351
345352
```yaml
346353
- id: foo-without-args
@@ -351,14 +358,15 @@ For example:
351358
name: ...
352359
language: julia
353360
entry: bin/bar.jl --arg1 --arg2
361+
- id: baz-with-extra-deps
362+
name: ...
363+
language: julia
364+
entry: bin/baz.jl
365+
additional_dependencies:
366+
- 'ExtraDepA@1'
367+
354368
```
355369
356-
This language supports `additional_dependencies` so it can be used as a `repo: local` hook.
357-
`additional_dependencies` are passed to `pkg> add` and should be specified using
358-
[Pkg REPL mode syntax](https://pkgdocs.julialang.org/v1/repl/#repl-add).
359-
Note that `additional_dependencies` can be used to override package versions in the
360-
`Project.toml` file of the hook repository.
361-
362370
__Support:__ julia hooks are known to work on any system which has `julia` installed.
363371

364372
### lua

0 commit comments

Comments
 (0)