Skip to content

Commit 7a87b5f

Browse files
authored
chore: switch to Runic formatting from JuliaFormatter (#871)
* Remove JuliaFormatter pre-commit * Apply Runic formatter * Update pre-commit and README * Install Runic in workflow
1 parent 3d622f0 commit 7a87b5f

File tree

139 files changed

+6510
-6501
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+6510
-6501
lines changed

.git-blame-ignore-revs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Apply Runic formatter
2+
24375d13a4645398b66909acf82708d9e45a4766

.github/workflows/PreCommit.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
push:
1010
branches:
1111
- main
12-
tags: ["*"]
12+
tags: ['*']
1313
pull_request:
1414
types: [opened, reopened, synchronize, ready_for_review]
1515
workflow_dispatch:
@@ -21,7 +21,7 @@ jobs:
2121
- uses: actions/checkout@v5
2222
- uses: julia-actions/setup-julia@v2
2323
- uses: julia-actions/cache@v2
24-
- run: julia -e 'using Pkg; Pkg.add("JuliaFormatter")'
25-
- uses: astral-sh/setup-uv@v6
24+
- run: julia -e 'using Pkg; Pkg.add("Runic")'
25+
- uses: astral-sh/setup-uv@v7
2626
- run: uv tool install pre-commit
2727
- run: pre-commit run --all-files --show-diff-on-failure --color always

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ repos:
66
- id: check-added-large-files
77
- id: check-merge-conflict
88
- id: no-commit-to-branch
9-
- repo: "https://github.com/domluna/JuliaFormatter.jl"
10-
rev: "v2.1.6" # or whatever the desired release is
9+
- repo: https://github.com/fredrikekre/runic-pre-commit
10+
rev: v1.0.0
1111
hooks:
12-
- id: "julia-formatter"
12+
- id: runic
1313
fail_fast: true

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ _Only the two maintainers are allowed to approve and merge pull requests._
99
Feel free to ping them if they do not answer within a week or so.
1010

1111
Apart from the conditions above, this repository follows the [ColPrac](https://github.com/SciML/ColPrac) best practices and [Conventional Commits](https://www.conventionalcommits.org/en/).
12-
Its code is formatted using [JuliaFormatter.jl](https://github.com/domluna/JuliaFormatter.jl) with [BlueStyle](https://github.com/JuliaDiff/BlueStyle).
12+
Its code is formatted using [Runic.jl](https://github.com/fredrikekre/Runic.jl).
1313
As part of continuous integration, a set of formal tests is run using [pre-commit](https://pre-commit.com/).
1414
We invite you to install pre-commit so that these checks are performed locally before you open or update a pull request.
1515
You can refer to the [dev guide](https://juliadiff.org/DifferentiationInterface.jl/DifferentiationInterface/dev/dev_guide/) for details on the package structure and the testing pipeline.

DifferentiationInterface/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
[![Build Status](https://github.com/JuliaDiff/DifferentiationInterface.jl/actions/workflows/Test.yml/badge.svg?branch=main)](https://github.com/JuliaDiff/DifferentiationInterface.jl/actions/workflows/Test.yml?query=branch%3Amain)
66
[![Coverage](https://codecov.io/gh/JuliaDiff/DifferentiationInterface.jl/branch/main/graph/badge.svg?flag=DI)](https://app.codecov.io/gh/JuliaDiff/DifferentiationInterface.jl)
7-
[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/JuliaDiff/BlueStyle)
7+
[![code style: runic](https://img.shields.io/badge/code_style-%E1%9A%B1%E1%9A%A2%E1%9A%BE%E1%9B%81%E1%9A%B2-black)](https://github.com/fredrikekre/Runic.jl)
88
[![ColPrac: Contributor's Guide on Collaborative Practices for Community Packages](https://img.shields.io/badge/ColPrac-Contributor%27s%20Guide-blueviolet)](https://github.com/SciML/ColPrac)
99
[![DOI](https://zenodo.org/badge/740973714.svg)](https://zenodo.org/doi/10.5281/zenodo.11092033)
1010

11-
| Package | Docs |
12-
|:----------------------------:|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
13-
| DifferentiationInterface | [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliadiff.org/DifferentiationInterface.jl/DifferentiationInterface/stable/) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliadiff.org/DifferentiationInterface.jl/DifferentiationInterface/dev/) |
11+
| Package | Docs |
12+
| :--------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: |
13+
| DifferentiationInterface | [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliadiff.org/DifferentiationInterface.jl/DifferentiationInterface/stable/) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliadiff.org/DifferentiationInterface.jl/DifferentiationInterface/dev/) |
1414
| DifferentiationInterfaceTest | [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliadiff.org/DifferentiationInterface.jl/DifferentiationInterfaceTest/stable/) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliadiff.org/DifferentiationInterface.jl/DifferentiationInterfaceTest/dev/) |
1515

1616
An interface to various automatic differentiation (AD) backends in Julia.

DifferentiationInterface/docs/make.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ readme_str = replace(readme_str, "> [!CAUTION]\n> " => "!!! warning\n ")
2121
write(joinpath(@__DIR__, "src", "index.md"), readme_str)
2222

2323
makedocs(;
24-
modules=[DifferentiationInterface],
25-
authors="Guillaume Dalle, Adrian Hill",
26-
sitename="DifferentiationInterface.jl",
27-
format=Documenter.HTML(; assets=["assets/favicon.ico"]),
28-
pages=[
24+
modules = [DifferentiationInterface],
25+
authors = "Guillaume Dalle, Adrian Hill",
26+
sitename = "DifferentiationInterface.jl",
27+
format = Documenter.HTML(; assets = ["assets/favicon.ico"]),
28+
pages = [
2929
"Home" => "index.md",
3030
"Tutorials" => ["tutorials/basic.md", "tutorials/advanced.md"],
3131
"Explanation" => [
@@ -37,13 +37,13 @@ makedocs(;
3737
"api.md",
3838
"dev_guide.md",
3939
],
40-
plugins=[links],
40+
plugins = [links],
4141
)
4242

4343
deploydocs(;
44-
repo="github.com/JuliaDiff/DifferentiationInterface.jl",
45-
devbranch="main",
46-
dirname="DifferentiationInterface",
47-
tag_prefix="DifferentiationInterface-",
48-
push_preview=false,
44+
repo = "github.com/JuliaDiff/DifferentiationInterface.jl",
45+
devbranch = "main",
46+
dirname = "DifferentiationInterface",
47+
tag_prefix = "DifferentiationInterface-",
48+
push_preview = false,
4949
)

DifferentiationInterface/docs/src/assets/logo.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ logo = begin
3232

3333
# Define center points and corners of triangle
3434
center = Point(0, 4)
35-
corners = ngon(center, 16, 3, -0.75π / 2; vertices=true)
35+
corners = ngon(center, 16, 3, -0.75π / 2; vertices = true)
3636

3737
# Draw three blended partials
3838
for (i, c) in enumerate(corners)
3939
b = blend(c, 0, center, 50, colors[i], black)
4040
setblend(b)
41-
text("", c; valign=:middle, halign=:center, angle=0.68π + 2π / 3 * i)
41+
text("", c; valign = :middle, halign = :center, angle = 0.68π + 2π / 3 * i)
4242
end
4343

4444
finish()

DifferentiationInterface/ext/DifferentiationInterfaceChainRulesCoreExt/reverse_onearg.jl

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
11
## Pullback
22

3-
struct ChainRulesPullbackPrepSamePoint{SIG,Y,PB} <: DI.PullbackPrep{SIG}
3+
struct ChainRulesPullbackPrepSamePoint{SIG, Y, PB} <: DI.PullbackPrep{SIG}
44
_sig::Val{SIG}
55
y::Y
66
pb::PB
77
end
88

99
function DI.prepare_pullback_nokwarg(
10-
strict::Val,
11-
f,
12-
backend::AutoReverseChainRules,
13-
x,
14-
ty::NTuple,
15-
contexts::Vararg{DI.GeneralizedConstant,C};
16-
) where {C}
10+
strict::Val,
11+
f,
12+
backend::AutoReverseChainRules,
13+
x,
14+
ty::NTuple,
15+
contexts::Vararg{DI.GeneralizedConstant, C}
16+
) where {C}
1717
_sig = DI.signature(f, backend, x, ty, contexts...; strict)
1818
return DI.NoPullbackPrep(_sig)
1919
end
2020

2121
function DI.prepare_pullback_same_point(
22-
f,
23-
prep::DI.NoPullbackPrep,
24-
backend::AutoReverseChainRules,
25-
x,
26-
ty::NTuple,
27-
contexts::Vararg{DI.GeneralizedConstant,C};
28-
) where {C}
22+
f,
23+
prep::DI.NoPullbackPrep,
24+
backend::AutoReverseChainRules,
25+
x,
26+
ty::NTuple,
27+
contexts::Vararg{DI.GeneralizedConstant, C}
28+
) where {C}
2929
DI.check_prep(f, prep, backend, x, ty, contexts...)
30-
_sig = DI.signature(f, backend, x, ty, contexts...; strict=DI.is_strict(prep))
30+
_sig = DI.signature(f, backend, x, ty, contexts...; strict = DI.is_strict(prep))
3131
rc = ruleconfig(backend)
3232
y, pb = rrule_via_ad(rc, f, x, map(DI.unwrap, contexts)...)
3333
return ChainRulesPullbackPrepSamePoint(_sig, y, pb)
3434
end
3535

3636
function DI.value_and_pullback(
37-
f,
38-
prep::DI.NoPullbackPrep,
39-
backend::AutoReverseChainRules,
40-
x,
41-
ty::NTuple,
42-
contexts::Vararg{DI.GeneralizedConstant,C},
43-
) where {C}
37+
f,
38+
prep::DI.NoPullbackPrep,
39+
backend::AutoReverseChainRules,
40+
x,
41+
ty::NTuple,
42+
contexts::Vararg{DI.GeneralizedConstant, C},
43+
) where {C}
4444
DI.check_prep(f, prep, backend, x, ty, contexts...)
4545
rc = ruleconfig(backend)
4646
y, pb = rrule_via_ad(rc, f, x, map(DI.unwrap, contexts)...)
@@ -51,13 +51,13 @@ function DI.value_and_pullback(
5151
end
5252

5353
function DI.value_and_pullback(
54-
f,
55-
prep::ChainRulesPullbackPrepSamePoint,
56-
backend::AutoReverseChainRules,
57-
x,
58-
ty::NTuple,
59-
contexts::Vararg{DI.GeneralizedConstant,C},
60-
) where {C}
54+
f,
55+
prep::ChainRulesPullbackPrepSamePoint,
56+
backend::AutoReverseChainRules,
57+
x,
58+
ty::NTuple,
59+
contexts::Vararg{DI.GeneralizedConstant, C},
60+
) where {C}
6161
DI.check_prep(f, prep, backend, x, ty, contexts...)
6262
(; y, pb) = prep
6363
tx = map(ty) do dy
@@ -67,13 +67,13 @@ function DI.value_and_pullback(
6767
end
6868

6969
function DI.pullback(
70-
f,
71-
prep::ChainRulesPullbackPrepSamePoint,
72-
backend::AutoReverseChainRules,
73-
x,
74-
ty::NTuple,
75-
contexts::Vararg{DI.GeneralizedConstant,C},
76-
) where {C}
70+
f,
71+
prep::ChainRulesPullbackPrepSamePoint,
72+
backend::AutoReverseChainRules,
73+
x,
74+
ty::NTuple,
75+
contexts::Vararg{DI.GeneralizedConstant, C},
76+
) where {C}
7777
DI.check_prep(f, prep, backend, x, ty, contexts...)
7878
(; pb) = prep
7979
tx = map(ty) do dy

DifferentiationInterface/ext/DifferentiationInterfaceDiffractorExt/DifferentiationInterfaceDiffractorExt.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ DI.pullback_performance(::AutoDiffractor) = DI.PullbackSlow()
1111
## Pushforward
1212

1313
function DI.prepare_pushforward_nokwarg(
14-
strict::Val, f, backend::AutoDiffractor, x, tx::NTuple
15-
)
14+
strict::Val, f, backend::AutoDiffractor, x, tx::NTuple
15+
)
1616
_sig = DI.signature(f, backend, x, tx; strict)
1717
return DI.NoPushforwardPrep(_sig)
1818
end
1919

2020
function DI.pushforward(
21-
f, prep::DI.NoPushforwardPrep, backend::AutoDiffractor, x, tx::NTuple
22-
)
21+
f, prep::DI.NoPushforwardPrep, backend::AutoDiffractor, x, tx::NTuple
22+
)
2323
DI.check_prep(f, prep, backend, x, tx)
2424
ty = map(tx) do dx
2525
# code copied from Diffractor.jl
@@ -31,8 +31,8 @@ function DI.pushforward(
3131
end
3232

3333
function DI.value_and_pushforward(
34-
f, prep::DI.NoPushforwardPrep, backend::AutoDiffractor, x, tx::NTuple
35-
)
34+
f, prep::DI.NoPushforwardPrep, backend::AutoDiffractor, x, tx::NTuple
35+
)
3636
DI.check_prep(f, prep, backend, x, tx)
3737
return f(x), DI.pushforward(f, prep, backend, x, tx)
3838
end

0 commit comments

Comments
 (0)