Skip to content

Commit b52c630

Browse files
authored
add Docs, TagBot, CompatHelper (#10)
* add Docs, TagBot, CompatHelper * link to JuliaHEP in docs * cleaned make.jl * right ref and indenting * repolink * julia formatter
1 parent f3c7b7b commit b52c630

15 files changed

+263
-72
lines changed

.JuliaFormatter.toml

+3
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
# See https://domluna.github.io/JuliaFormatter.jl/stable/ for a list of options
22
style = "blue"
3+
indent = 4
4+
margin = 92
5+
normalize_line_endings = "unix"

.editorconfig

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# https://editorconfig.org
2+
root = true
3+
4+
[*]
5+
end_of_line = lf
6+
insert_final_newline = true
7+
charset = utf-8
8+
indent_size = 4
9+
indent_style = space
10+
trim_trailing_whitespace = true

.github/PULL_REQUEST_TEMPLATE.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<!--
2+
Thanks for making a pull request to LorentzVectorBase.jl.
3+
We have added this PR template to help you help us.
4+
5+
See the comments below, fill the required fields, and check the items.
6+
-->
7+
8+
## Related issues
9+
10+
<!-- We normally work with (i) create issue; (ii) discussion if necessary; (iii) create PR. So, at least one of the following should be true:-->
11+
12+
<!-- Option 1, this closes an existing issue. Fill the number below-->
13+
Closes #
14+
15+
<!-- Option 2, this is a small fix that arguably won't need an issue. Uncomment below -->
16+
<!--
17+
There is no related issue.
18+
-->
19+
20+
## Checklist
21+
22+
<!-- mark true if NA -->
23+
<!-- leave PR as draft until all is checked -->
24+
25+
- [ ] Tests are passing
26+
- [ ] Docs were updated and workflow is passing

.github/workflows/CompatHelper.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# CompatHelper v3.5.0
2+
name: CompatHelper
3+
4+
on:
5+
schedule:
6+
- cron: 0 0 * * * # Every day at 00:00 UTC
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
CompatHelper:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Check if Julia is already available in the PATH
18+
id: julia_in_path
19+
run: which julia
20+
continue-on-error: true
21+
- name: Install Julia, but only if it is not already available in the PATH
22+
uses: julia-actions/setup-julia@v2
23+
with:
24+
version: "1"
25+
arch: ${{ runner.arch }}
26+
if: steps.julia_in_path.outcome != 'success'
27+
- name: Use Julia cache
28+
uses: julia-actions/cache@v2
29+
- name: "Add the General registry via Git"
30+
run: |
31+
import Pkg
32+
ENV["JULIA_PKG_SERVER"] = ""
33+
Pkg.Registry.add("General")
34+
shell: julia --color=yes {0}
35+
- name: "Install CompatHelper"
36+
run: |
37+
import Pkg
38+
name = "CompatHelper"
39+
uuid = "aa819f21-2bde-4658-8897-bab36330d9b7"
40+
version = "3"
41+
Pkg.add(; name, uuid, version)
42+
shell: julia --color=yes {0}
43+
- name: "Run CompatHelper"
44+
run: |
45+
import CompatHelper
46+
CompatHelper.main()
47+
shell: julia --color=yes {0}
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}
51+
# COMPATHELPER_PRIV: ${{ secrets.COMPATHELPER_PRIV }}

.github/workflows/Docs.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "docs/**"
9+
- "src/**"
10+
- "*.toml"
11+
tags: ["*"]
12+
pull_request:
13+
branches:
14+
- main
15+
paths:
16+
- "docs/**"
17+
- "src/**"
18+
- "*.toml"
19+
types: [opened, synchronize, reopened]
20+
21+
concurrency:
22+
# Skip intermediate builds: always.
23+
# Cancel intermediate builds: only if it is a pull request build.
24+
group: ${{ github.workflow }}-${{ github.ref }}
25+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
26+
27+
jobs:
28+
docs:
29+
name: Documentation
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: julia-actions/setup-julia@v2
34+
with:
35+
version: "1"
36+
- name: Use Julia cache
37+
uses: julia-actions/cache@v2
38+
- run: |
39+
julia --project=docs -e '
40+
using Pkg
41+
Pkg.develop(PackageSpec(path=pwd()))
42+
Pkg.instantiate()'
43+
- run: |
44+
julia --project=docs -e '
45+
using Documenter: DocMeta, doctest
46+
using LorentzVectorBase
47+
DocMeta.setdocmeta!(LorentzVectorBase, :DocTestSetup, :(using LorentzVectorBase); recursive=true)
48+
doctest(LorentzVectorBase)'
49+
- run: julia --project=docs docs/make.jl
50+
env:
51+
JULIA_PKG_SERVER: ""
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
54+
GKSwstype: "100" # https://discourse.julialang.org/t/generation-of-documentation-fails-qt-qpa-xcb-could-not-connect-to-display/60988

.github/workflows/TagBot.yml

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: TagBot
2+
3+
on:
4+
issue_comment:
5+
types:
6+
- created
7+
workflow_dispatch:
8+
inputs:
9+
lookback:
10+
type: number
11+
default: 3
12+
13+
permissions:
14+
actions: read
15+
checks: read
16+
contents: write
17+
deployments: read
18+
issues: read
19+
discussions: read
20+
packages: read
21+
pages: read
22+
pull-requests: read
23+
repository-projects: read
24+
security-events: read
25+
statuses: read
26+
27+
jobs:
28+
TagBot:
29+
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: JuliaRegistries/TagBot@v1
33+
with:
34+
token: ${{ secrets.GITHUB_TOKEN }}
35+
# Edit the following line to reflect the actual name of the GitHub Secret containing your private key
36+
ssh: ${{ secrets.DOCUMENTER_KEY }}
37+
# ssh: ${{ secrets.NAME_OF_MY_SSH_PRIVATE_KEY_SECRET }}

Project.toml

-8
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,3 @@ version = "0.0.1-DEV"
88
[compat]
99
julia = "1.6"
1010

11-
[extras]
12-
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
13-
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
14-
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
15-
16-
[targets]
17-
test = ["Test", "Random","SafeTestsets"]
18-

README.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
# LorentzVectorBase.jl
2-
[WIP] Base interfaces for four-momenta in high-energy physics.
1+
# LorentzVectorBase
32

4-
<!-- [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://szabo137.github.io/LorentzVectorBase.jl/stable/)
5-
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://szabo137.github.io/LorentzVectorBase.jl/dev/) -->
3+
Base interfaces for four-momenta in high-energy physics.
64

7-
[![Build Status](https://github.com/JuliaHEP/LorentzVectorBase.jl/actions/workflows/Test.yml/badge.svg?branch=main)](https://github.com/JuliaHEP/LorentzVectorBase.jl/actions/workflows/Test.yml?query=branch%3Amain)
5+
[![Stable Documentation](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaHEP.github.io/LorentzVectorBase.jl/stable/)
6+
[![In development documentation](https://img.shields.io/badge/docs-dev-blue.svg)](https://JuliaHEP.github.io/LorentzVectorBase.jl/dev/)
7+
[![Test workflow status](https://github.com/JuliaHEP/LorentzVectorBase.jl/actions/workflows/Test.yml/badge.svg?branch=main)](https://github.com/JuliaHEP/LorentzVectorBase.jl/actions/workflows/Test.yml?query=branch%3Amain)
8+
[![Docs workflow Status](https://github.com/JuliaHEP/LorentzVectorBase.jl/actions/workflows/Docs.yml/badge.svg?branch=main)](https://github.com/JuliaHEP/LorentzVectorBase.jl/actions/workflows/Docs.yml?query=branch%3Amain)
9+
[![Coverage](https://codecov.io/gh/JuliaHEP/LorentzVectorBase.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/JuliaHEP/LorentzVectorBase.jl)

docs/make.jl

+11-4
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,23 @@ DocMeta.setdocmeta!(
55
LorentzVectorBase, :DocTestSetup, :(using LorentzVectorBase); recursive=true
66
)
77

8+
const numbered_pages = [
9+
file for file in readdir(joinpath(@__DIR__, "src")) if
10+
file != "index.md" && splitext(file)[2] == ".md"
11+
]
12+
813
makedocs(;
914
modules=[LorentzVectorBase],
10-
authors="Uwe Hernandez Acosta <[email protected]",
15+
authors="Uwe Hernandez Acosta <[email protected]>",
16+
repo="https://github.com/JuliaHEP/LorentzVectorBase.jl/blob/{commit}{path}#{line}",
1117
sitename="LorentzVectorBase.jl",
1218
format=Documenter.HTML(;
13-
canonical="https://szabo137.github.io/LorentzVectorBase.jl",
19+
canonical="https://JuliaHEP.github.io/LorentzVectorBase.jl",
20+
repolink="https://github.com/JuliaHEP/LorentzVectorBase.jl",
1421
edit_link="main",
1522
assets=String[],
1623
),
17-
pages=["Home" => "index.md"],
24+
pages=["index.md"; numbered_pages],
1825
)
1926

20-
deploydocs(; repo="github.com/szabo137/LorentzVectorBase.jl", devbranch="main")
27+
deploydocs(; repo="github.com/JuliaHEP/LorentzVectorBase.jl")

docs/src/95-reference.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# [Reference](@id reference)
2+
3+
## Contents
4+
5+
```@contents
6+
Pages = ["95-reference.md"]
7+
```
8+
9+
## Index
10+
11+
```@index
12+
Pages = ["95-reference.md"]
13+
```
14+
15+
```@autodocs
16+
Modules = [LorentzVectorBase]
17+
```

docs/src/index.md

+1-6
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ CurrentModule = LorentzVectorBase
44

55
# LorentzVectorBase
66

7-
Documentation for [LorentzVectorBase](https://github.com/szabo137/LorentzVectorBase.jl).
7+
Documentation for [LorentzVectorBase](https://github.com/JuliaHEP/LorentzVectorBase.jl).
88

9-
```@index
10-
```
119

12-
```@autodocs
13-
Modules = [LorentzVectorBase]
14-
```

src/coordinate_systems/PtEtaPhiM.jl

+4-5
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ mass(::CustomFourMomentum)
1515
struct PtEtaPhiM <: AbstractCoordinateSystem end
1616
coordinate_names(::PtEtaPhiM) = (:pt, :eta, :phi, :energy)
1717

18-
1918
####
2019
# derived components
2120
####
@@ -25,19 +24,19 @@ py(::PtEtaPhiM, v) = pt(v) * sin(phi(v))
2524
pz(::PtEtaPhiM, v) = pt(v) * sinh(eta(v))
2625

2726
function energy(::PtEtaPhiM, mom)
28-
sqrt(px(mom)^2 + py(mom)^2 + pz(mom)^2 + invariant_mass2(mom))
27+
return sqrt(px(mom)^2 + py(mom)^2 + pz(mom)^2 + invariant_mass2(mom))
2928
end
3029

3130
@inline function spatial_magnitude2(::PtEtaPhiM, mom)
32-
return pt(mom)^2 * (1+sinh(eta(mom))^2)
31+
return pt(mom)^2 * (1 + sinh(eta(mom))^2)
3332
end
3433

3534
@inline function spatial_magnitude(::PtEtaPhiM, mom)
3635
return sqrt(spatial_magnitude2(mom))
3736
end
3837

3938
@inline function mass2(::PtEtaPhiM, mom)
40-
mass(mom)^2
39+
return mass(mom)^2
4140
end
4241

4342
@inline function boost_beta(::PtEtaPhiM, mom)
@@ -85,7 +84,7 @@ end
8584
@inline function rapidity(::PtEtaPhiM, mom)
8685
E = energy(mom)
8786
pz1 = pz(mom)
88-
return 0.5*log((E+pz1)/(E-pz1))
87+
return 0.5 * log((E + pz1) / (E - pz1))
8988
end
9089

9190
#######################

0 commit comments

Comments
 (0)