Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize yml files / Polynomials v4 compat #85

Merged
merged 6 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

version: 2
updates:
- package-ecosystem: "github-actions"
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "weekly"
5 changes: 4 additions & 1 deletion .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: julia-actions/setup-julia@latest
with:
version: '1'
arch: ${{ runner.arch }}
# arch: ${{ runner.arch }}
if: steps.julia_in_path.outcome != 'success'
- name: "Add the General registry via Git"
run: |
Expand All @@ -43,3 +43,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}

# based on:
# https://github.com/JuliaRegistries/CompatHelper.jl
4 changes: 2 additions & 2 deletions .github/workflows/Documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: julia-actions/setup-julia@latest
with:
version: '1'
- name: Cache artifacts
- name: CacheArtifacts
uses: actions/cache@v4
env:
cache-name: cache-artifacts
Expand All @@ -31,7 +31,7 @@ jobs:
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- name: Install dependencies
- name: InstallDependencies
run: |
julia --project=docs/ -e '
ENV["JULIA_PKG_SERVER"] = ""
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/SpellCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Spell Check

on: [pull_request]

jobs:
typos-check:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4
- name: Check spelling
uses: crate-ci/typos@master
2 changes: 2 additions & 0 deletions .github/workflows/TagBot.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
name: TagBot

on:
issue_comment:
types:
- created
workflow_dispatch:

jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Polynomials = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"

[compat]
Polynomials = "1, 2, 3"
Polynomials = "1, 2, 3, 4"
julia = "1.6"
9 changes: 9 additions & 0 deletions docs/inc/reproduce.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

# ### Reproducibility

# This page was generated with the following version of Julia:
using InteractiveUtils: versioninfo
io = IOBuffer(); versioninfo(io); split(String(take!(io)), '\n')

# And with the following package versions
import Pkg; Pkg.status()
14 changes: 14 additions & 0 deletions docs/inc/urls.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

#=
This page comes from a single Julia file:
[`@__NAME__.jl`](xxxrepo/@__NAME__.jl).

You can access the source code
for such Julia documentation
using the 'Edit on GitHub' link in the top right.
You can view the corresponding notebook in
[nbviewer](https://nbviewer.org/) here:
[`@__NAME__.ipynb`](xxxnb/@__NAME__.ipynb),
or open it in [binder](https://mybinder.org/) here:
[`@__NAME__.ipynb`](xxxbinder/@__NAME__.ipynb).
=#
7 changes: 7 additions & 0 deletions docs/lit/examples/1-overview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ supports
Toeplitz, Hankel, and circulant matrices.
=#

#srcURL


# ### Setup

# Packages needed here.
Expand Down Expand Up @@ -88,6 +91,7 @@ Kahan(5, 3, 0.5, 0)
#
Kahan(3, 5, 0.5, 1e-3)


#=
## `Riemann` matrix

Expand Down Expand Up @@ -140,3 +144,6 @@ V \ a

#
V' \ V[3,:]


include("../../../inc/reproduce.jl")
50 changes: 38 additions & 12 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ execute = isempty(ARGS) || ARGS[1] == "run"

org, reps = :JuliaLinearAlgebra, :SpecialMatrices
eval(:(using $reps))
using Documenter
using Literate
import Documenter
import Literate

# https://juliadocs.github.io/Documenter.jl/stable/man/syntax/#@example-block
ENV["GKSwstype"] = "100"
Expand All @@ -15,25 +15,51 @@ src = joinpath(@__DIR__, "src")
gen = joinpath(@__DIR__, "src/generated")

base = "$org/$reps.jl"
repo_root_url =
"https://github.com/$base/blob/main"
repo_root_url = "https://github.com/$base/blob/main"
nbviewer_root_url =
"https://nbviewer.org/github/$base/tree/gh-pages/dev/generated/examples"
binder_root_url =
"https://mybinder.org/v2/gh/$base/gh-pages?filepath=dev/generated/examples"


repo = eval(:($reps))
DocMeta.setdocmeta!(repo, :DocTestSetup, :(using $reps); recursive=true)
Documenter.DocMeta.setdocmeta!(repo, :DocTestSetup, :(using $reps); recursive=true)

# preprocessing
inc1 = "include(\"../../../inc/reproduce.jl\")"

function prep_markdown(str, root, file)
inc_read(file) = read(joinpath("docs/inc", file), String)
repro = inc_read("reproduce.jl")
str = replace(str, inc1 => repro)
urls = inc_read("urls.jl")
file = joinpath(splitpath(root)[end], splitext(file)[1])
tmp = splitpath(root)[end-3:end] # docs lit demos 00
urls = replace(urls,
"xxxrepo" => joinpath(repo_root_url, tmp...),
"xxxnb" => joinpath(nbviewer_root_url, tmp[end]),
"xxxbinder" => joinpath(binder_root_url, tmp[end]),
)
str = replace(str, "#srcURL" => urls)
end

function prep_notebook(str)
str = replace(str, inc1 => "", "#srcURL" => "")
end

for (root, _, files) in walkdir(lit), file in files
splitext(file)[2] == ".jl" || continue # process .jl files only
ipath = joinpath(root, file)
opath = splitdir(replace(ipath, lit => gen))[1]
Literate.markdown(ipath, opath; documenter = execute, # run examples
repo_root_url, nbviewer_root_url, binder_root_url)
Literate.notebook(ipath, opath; execute = false, # no-run notebooks
repo_root_url, nbviewer_root_url, binder_root_url)
Literate.markdown(ipath, opath;
repo_root_url,
preprocess = str -> prep_markdown(str, root, file),
documenter = execute, # run examples
)
Literate.notebook(ipath, opath;
preprocess = prep_notebook,
execute = false, # no-run notebooks
)
end


Expand All @@ -48,10 +74,10 @@ format = Documenter.HTML(;
prettyurls = isci,
edit_link = "main",
canonical = "https://$org.github.io/$repo.jl/stable/",
# assets = String[],
assets = ["assets/custom.css"],
)

makedocs(;
Documenter.makedocs(;
modules = [repo],
sitename = "$repo.jl",
format,
Expand All @@ -63,7 +89,7 @@ makedocs(;
)

if isci
deploydocs(;
Documenter.deploydocs(;
repo = "github.com/$base",
devbranch = "main",
devurl = "dev",
Expand Down
3 changes: 3 additions & 0 deletions docs/src/assets/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.docs-sourcelink {
opacity:1 !important;
}
2 changes: 1 addition & 1 deletion src/companion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Also, directly from a polynomial:
julia> using Polynomials

julia> P = Polynomial(2:5)
Polynomials.Polynomial(2 + 3*x + 4*x^2 + 5*x^3)
Polynomial(2 + 3*x + 4*x^2 + 5*x^3)

julia> C = Companion(P)
3×3 Companion{Float64}:
Expand Down
14 changes: 7 additions & 7 deletions src/hilbert.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ where element `i,j` equal to `1 / (i+j-1)`.
```jldoctest hilbert1
julia> A = Hilbert(5)
5×5 Hilbert{Rational{Int64}}:
1//1 1//2 1//3 1//4 1//5
1 1//2 1//3 1//4 1//5
1//2 1//3 1//4 1//5 1//6
1//3 1//4 1//5 1//6 1//7
1//4 1//5 1//6 1//7 1//8
1//5 1//6 1//7 1//8 1//9

julia> Matrix(A)
5×5 Matrix{Rational{Int64}}:
1//1 1//2 1//3 1//4 1//5
1 1//2 1//3 1//4 1//5
1//2 1//3 1//4 1//5 1//6
1//3 1//4 1//5 1//6 1//7
1//4 1//5 1//6 1//7 1//8
Expand All @@ -34,11 +34,11 @@ Inverses are also integer matrices:
```jldoctest hilbert1
julia> inv(A)
5×5 InverseHilbert{Rational{Int64}}:
25//1 -300//1 1050//1 -1400//1 630//1
-300//1 4800//1 -18900//1 26880//1 -12600//1
1050//1 -18900//1 79380//1 -117600//1 56700//1
-1400//1 26880//1 -117600//1 179200//1 -88200//1
630//1 -12600//1 56700//1 -88200//1 44100//1
25 -300 1050 -1400 630
-300 4800 -18900 26880 -12600
1050 -18900 79380 -117600 56700
-1400 26880 -117600 179200 -88200
630 -12600 56700 -88200 44100
```
"""
struct Hilbert{T} <: AbstractMatrix{T}
Expand Down
Loading