◐ Shell
reader mode source ↗
Skip to content

Add support for julia hooks#3348

Merged
asottile merged 1 commit into
pre-commit:mainfrom
fredrikekre:fe/julia
Nov 25, 2024
Merged

Add support for julia hooks#3348
asottile merged 1 commit into
pre-commit:mainfrom
fredrikekre:fe/julia

Conversation

@fredrikekre

Copy link
Copy Markdown
Contributor

This patch adds 2nd class support for hooks using julia as the language. pre-commit will install any dependencies defined in the hooks repo Project.toml file, with support for additional_dependencies as well. Julia doesn't (yet) have a way to install binaries/scripts so for julia hooks the entry value is a (relative) path to a julia script within the hooks repository. When executing a julia hook the (globally installed) julia interpreter is prepended to the entry.

Example .pre-commit-hooks.yaml:

- id: foo
  name: ...
  language: julia
  entry: bin/foo.jl --arg1

Example hooks repo: https://github.com/fredrikekre/runic-pre-commit/tree/fe/julia
Accompanying pre-commit.com PR: pre-commit/pre-commit.com#998

Fixes #2689.

fredrikekre added a commit to fredrikekre/pre-commit.com that referenced this pull request Nov 1, 2024
@fredrikekre fredrikekre force-pushed the fe/julia branch 2 times, most recently from bc41985 to 54d9104 Compare November 3, 2024 01:13
This patch adds 2nd class support for hooks using julia as the language.
pre-commit will install any dependencies defined in the hooks repo
`Project.toml` file, with support for `additional_dependencies` as well.
Julia doesn't (yet) have a way to install binaries/scripts so for julia
hooks the `entry` value is a (relative) path to a julia script within
the hooks repository. When executing a julia hook the (globally
installed) julia interpreter is prepended to the entry.

Example `.pre-commit-hooks.yaml`:

```yaml
- id: foo
  name: ...
  language: julia
  entry: bin/foo.jl --arg1
```

Example hooks repo: https://github.com/fredrikekre/runic-pre-commit/tree/fe/julia
Accompanying pre-commit.com PR: pre-commit/pre-commit.com#998

Fixes pre-commit#2689.

@asottile asottile left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide comment

very cool! thanks for working on this :D

@asottile asottile enabled auto-merge November 25, 2024 23:32
@asottile asottile merged commit 74233a1 into pre-commit:main Nov 25, 2024
@fredrikekre fredrikekre deleted the fe/julia branch November 25, 2024 23:42
fredrikekre added a commit to fredrikekre/pre-commit.com that referenced this pull request Nov 26, 2024
@fredrikekre

Copy link
Copy Markdown
Contributor Author

Thanks for the review and merge! I have updated pre-commit/pre-commit.com#998 to match the final implementation here.

fredrikekre added a commit to fredrikekre/pre-commit.com that referenced this pull request Nov 26, 2024
@fredrikekre

Copy link
Copy Markdown
Contributor Author

@asottile just out of curiosity, is there a timeline for a new release (4.1.0?) that includes this feature? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2nd-class support Julia

2 participants