diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 700707ce..5ace4600 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,7 +1,6 @@ -# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates version: 2 updates: - package-ecosystem: "github-actions" - directory: "/" # Location of package manifests + directory: "/" schedule: interval: "weekly" diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml index 456fa05d..70f2dc60 100644 --- a/.github/workflows/CompatHelper.yml +++ b/.github/workflows/CompatHelper.yml @@ -1,13 +1,11 @@ name: "CompatHelper" - on: schedule: - - cron: 0 0 * * * - workflow_dispatch: + - cron: "0 0 * * *" + workflow_dispatch: ~ permissions: - contents: write - pull-requests: write - + contents: "write" + pull-requests: "write" jobs: compat-helper: name: "CompatHelper" diff --git a/.github/workflows/Deploy.yml b/.github/workflows/Deploy.yml index 2ec3adfd..7e5388af 100644 --- a/.github/workflows/Deploy.yml +++ b/.github/workflows/Deploy.yml @@ -1,23 +1,25 @@ -name: Aggregate +name: "Aggregate" on: push: branches: - - main + - "main" schedule: - - cron: '0 0 * * *' - workflow_dispatch: + - cron: "0 0 * * *" + workflow_dispatch: ~ jobs: aggregate: - runs-on: ubuntu-latest + runs-on: "ubuntu-latest" steps: - - uses: actions/checkout@v6 - - uses: julia-actions/setup-julia@v2 + - uses: "actions/checkout@v6" + - uses: "julia-actions/setup-julia@v2" with: - version: '1' - - name: Install dependencies - run: julia --project=docs/ -e 'using Pkg; Pkg.develop(path="."); Pkg.instantiate()' - - name: Aggregate and deploy + version: "1" + - name: "Install dependencies" + run: |- + julia --project=docs/ -e 'using Pkg; Pkg.develop(path="."); Pkg.instantiate()' + - name: "Aggregate and deploy" run: | git config user.name github-actions git config user.email github-actions@github.com julia --project=docs/ docs/make.jl deploy + diff --git a/.github/workflows/FormatCheck.yml b/.github/workflows/FormatCheck.yml index 3f78afc2..44f35579 100644 --- a/.github/workflows/FormatCheck.yml +++ b/.github/workflows/FormatCheck.yml @@ -1,12 +1,10 @@ name: "Format Check" - on: push: branches: - - 'main' - tags: '*' - pull_request: - + - "main" + tags: "*" + pull_request: ~ jobs: format-check: name: "Format Check" diff --git a/.github/workflows/IntegrationTestRequest.yml b/.github/workflows/IntegrationTestRequest.yml index d42fccaa..6f58e45b 100644 --- a/.github/workflows/IntegrationTestRequest.yml +++ b/.github/workflows/IntegrationTestRequest.yml @@ -1,14 +1,14 @@ name: "Integration Test Request" - on: issue_comment: - types: [created] - + types: + - "created" jobs: integrationrequest: if: | github.event.issue.pull_request && contains(fromJSON('["OWNER", "COLLABORATOR", "MEMBER"]'), github.event.comment.author_association) - uses: ITensor/ITensorActions/.github/workflows/IntegrationTestRequest.yml@main + + uses: "ITensor/ITensorActions/.github/workflows/IntegrationTestRequest.yml@main" with: - localregistry: https://github.com/ITensor/ITensorRegistry.git + localregistry: "https://github.com/ITensor/ITensorRegistry.git" diff --git a/.github/workflows/LiterateCheck.yml b/.github/workflows/LiterateCheck.yml index 2ca5f27e..efa25ca0 100644 --- a/.github/workflows/LiterateCheck.yml +++ b/.github/workflows/LiterateCheck.yml @@ -1,15 +1,13 @@ name: "Literate Check" - on: push: branches: - - 'main' - tags: '*' - pull_request: - + - "main" + tags: "*" + pull_request: ~ jobs: literate: name: "Literate Check" uses: "ITensor/ITensorActions/.github/workflows/LiterateCheck.yml@main" with: - localregistry: https://github.com/ITensor/ITensorRegistry.git + localregistry: "https://github.com/ITensor/ITensorRegistry.git" diff --git a/.github/workflows/Registrator.yml b/.github/workflows/Registrator.yml index 255e2af9..00a7dd2d 100644 --- a/.github/workflows/Registrator.yml +++ b/.github/workflows/Registrator.yml @@ -1,24 +1,22 @@ -name: Register Package +name: "Register Package" on: - workflow_dispatch: + workflow_dispatch: ~ pull_request: types: - - closed + - "closed" paths: - - 'Project.toml' + - "Project.toml" branches: - - 'master' - - 'main' - + - "master" + - "main" permissions: - contents: write - pull-requests: write - + contents: "write" + pull-requests: "write" jobs: Register: - if: github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true + if: "github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true" uses: "ITensor/ITensorActions/.github/workflows/Registrator.yml@main" with: - localregistry: ITensor/ITensorRegistry + localregistry: "ITensor/ITensorRegistry" secrets: - REGISTRATOR_KEY: ${{ secrets.REGISTRATOR_KEY }} + REGISTRATOR_KEY: "${{ secrets.REGISTRATOR_KEY }}" diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml index 0cd3114e..8c36db74 100644 --- a/.github/workflows/TagBot.yml +++ b/.github/workflows/TagBot.yml @@ -1,31 +1,31 @@ -name: TagBot +name: "TagBot" on: issue_comment: types: - - created + - "created" workflow_dispatch: inputs: lookback: default: "3" permissions: - actions: read - checks: read - contents: write - deployments: read - issues: read - discussions: read - packages: read - pages: read - pull-requests: read - repository-projects: read - security-events: read - statuses: read + actions: "read" + checks: "read" + contents: "write" + deployments: "read" + issues: "read" + discussions: "read" + packages: "read" + pages: "read" + pull-requests: "read" + repository-projects: "read" + security-events: "read" + statuses: "read" jobs: TagBot: - if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' - runs-on: ubuntu-latest + if: "github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'" + runs-on: "ubuntu-latest" steps: - - uses: JuliaRegistries/TagBot@v1 + - uses: "JuliaRegistries/TagBot@v1" with: - token: ${{ secrets.GITHUB_TOKEN }} - ssh: ${{ secrets.DOCUMENTER_KEY }} + token: "${{ secrets.GITHUB_TOKEN }}" + ssh: "${{ secrets.DOCUMENTER_KEY }}" diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml index 5a0a3064..93e646ed 100644 --- a/.github/workflows/Tests.yml +++ b/.github/workflows/Tests.yml @@ -1,21 +1,18 @@ -name: Tests +name: "Tests" on: push: branches: - - 'master' - - 'main' - - 'release-' - tags: '*' + - "master" + - "main" + - "release-" + tags: "*" paths-ignore: - - 'docs/**' - pull_request: - workflow_dispatch: - + - "docs/**" + pull_request: ~ + workflow_dispatch: ~ concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - # Cancel intermediate builds: only if it is a pull request build. - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} - + group: "${{ github.workflow }}-${{ github.ref }}" + cancel-in-progress: "${{ startsWith(github.ref, 'refs/pull/') }}" jobs: tests: name: "Tests" @@ -23,20 +20,17 @@ jobs: fail-fast: false matrix: version: - - 'lts' # minimal supported version - - '1' # latest released Julia version - # group: - # - 'core' - # - 'optional' + - "lts" + - "1" os: - - ubuntu-latest - - macOS-latest - - windows-latest + - "ubuntu-latest" + - "macOS-latest" + - "windows-latest" uses: "ITensor/ITensorActions/.github/workflows/Tests.yml@main" with: group: "${{ matrix.group }}" julia-version: "${{ matrix.version }}" os: "${{ matrix.os }}" - localregistry: https://github.com/ITensor/ITensorRegistry.git + localregistry: "https://github.com/ITensor/ITensorRegistry.git" secrets: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aa7e6684..bf0037f8 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,17 +1,17 @@ ci: - skip: [julia-formatter] - + skip: + - "julia-formatter" repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v6.0.0 - hooks: - - id: check-merge-conflict - - id: check-toml - - id: check-yaml - - id: end-of-file-fixer - exclude_types: [markdown] # incompatible with Literate.jl - -- repo: "https://github.com/domluna/JuliaFormatter.jl" - rev: v2.3.0 - hooks: - - id: "julia-formatter" + - repo: "https://github.com/pre-commit/pre-commit-hooks" + rev: "v6.0.0" + hooks: + - id: "check-merge-conflict" + - id: "check-toml" + - id: "check-yaml" + - id: "end-of-file-fixer" + exclude_types: + - "markdown" + - repo: "https://github.com/domluna/JuliaFormatter.jl" + rev: "v2.3.0" + hooks: + - id: "julia-formatter" diff --git a/Project.toml b/Project.toml index b74da736..7f3b5825 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ITensorDocs" uuid = "421c5ee2-4dae-4799-bb38-a6a9d9332403" +version = "0.1.1" authors = ["ITensor developers and contributors"] -version = "0.1.0" [compat] julia = "1.10" diff --git a/benchmark/benchmarks.jl b/benchmark/benchmarks.jl index c7b93803..4a4ac943 100644 --- a/benchmark/benchmarks.jl +++ b/benchmark/benchmarks.jl @@ -1,5 +1,5 @@ -using ITensorDocs using BenchmarkTools +using ITensorDocs SUITE = BenchmarkGroup() SUITE["rand"] = @benchmarkable rand(10) diff --git a/docs/Project.toml b/docs/Project.toml index 783d7cc3..c254046c 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,3 +1,4 @@ + [deps] Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" ITensorDocs = "421c5ee2-4dae-4799-bb38-a6a9d9332403" @@ -5,7 +6,7 @@ Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306" MultiDocumenter = "87ed4bf0-c935-4a67-83c3-2a03bee4197c" [compat] -Documenter = "1.9.0" -ITensorDocs = "0.1.0" +Documenter = "1.9" +ITensorDocs = "0.1" Literate = "2.20.1" MultiDocumenter = "0.8" diff --git a/docs/make.jl b/docs/make.jl index 52b3950a..27ae0025 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -20,91 +20,91 @@ Building aggregate site into: $(outpath) @info "Building Documenter site for ITensorDocs" include("make_index.jl") Documenter.makedocs(; - sitename="ITensor ecosystem docs", - modules=[ITensorDocs], - warnonly=true, - format=Documenter.HTML(; assets=["assets/favicon.ico", "assets/extras.css"]), - pages=[ - "Introduction" => "index.md", - "Frequently Asked Questions" => [ - "Programming Language (Julia, C++, ...) FAQs" => "faq/JuliaAndCpp.md", - "High-Performance Computing FAQs" => "faq/HPC.md", - ], - ], + sitename = "ITensor ecosystem docs", + modules = [ITensorDocs], + warnonly = true, + format = Documenter.HTML(; assets = ["assets/favicon.ico", "assets/extras.css"]), + pages = [ + "Introduction" => "index.md", + "Frequently Asked Questions" => [ + "Programming Language (Julia, C++, ...) FAQs" => "faq/JuliaAndCpp.md", + "High-Performance Computing FAQs" => "faq/HPC.md", + ], + ] ) -function itensor_multidocref(pkgname::String; clonedir::String=clonedir) - return MultiDocumenter.MultiDocRef(; - upstream=joinpath(clonedir, pkgname), - path=pkgname, - name=pkgname, - giturl="https://github.com/ITensor/$(pkgname).jl.git", - ) +function itensor_multidocref(pkgname::String; clonedir::String = clonedir) + return MultiDocumenter.MultiDocRef(; + upstream = joinpath(clonedir, pkgname), + path = pkgname, + name = pkgname, + giturl = "https://github.com/ITensor/$(pkgname).jl.git" + ) end @info "Building aggregate ITensorDocs site" docs = [ - # We also add ITensorDocs's own generated pages - MultiDocumenter.MultiDocRef(; - upstream=joinpath(@__DIR__, "build"), - path="Overview", - name="Home", - fix_canonical_url=false, - ), - itensor_multidocref("ITensors"), - itensor_multidocref("ITensorMPS"), + # We also add ITensorDocs's own generated pages + MultiDocumenter.MultiDocRef(; + upstream = joinpath(@__DIR__, "build"), + path = "Overview", + name = "Home", + fix_canonical_url = false + ), + itensor_multidocref("ITensors"), + itensor_multidocref("ITensorMPS"), ] MultiDocumenter.make( - outpath, - docs; - search_engine=MultiDocumenter.SearchConfig(; - index_versions=["stable"], engine=MultiDocumenter.FlexSearch - ), - rootpath="/ITensorDocs/", - canonical_domain="https://itensor.github.io/", - sitemap=true, - assets_dir="docs/src/assets", - brand_image=MultiDocumenter.BrandImage( - "https://itensor.org", joinpath("assets", "logo-dark.png") - ), + outpath, + docs; + search_engine = MultiDocumenter.SearchConfig(; + index_versions = ["stable"], engine = MultiDocumenter.FlexSearch + ), + rootpath = "/ITensorDocs/", + canonical_domain = "https://itensor.github.io/", + sitemap = true, + assets_dir = "docs/src/assets", + brand_image = MultiDocumenter.BrandImage( + "https://itensor.org", joinpath("assets", "logo-dark.png") + ) ) if "deploy" in ARGS - @warn "Deploying to GitHub" ARGS - gitroot = normpath(joinpath(@__DIR__, "..")) - run(`git pull`) - outbranch = "gh-pages" - has_outbranch = true - if !success(`git checkout $outbranch`) - has_outbranch = false - if !success(`git switch --orphan $outbranch`) - @error "Cannot create new orphaned branch $outbranch." - exit(1) + @warn "Deploying to GitHub" ARGS + gitroot = normpath(joinpath(@__DIR__, "..")) + run(`git pull`) + outbranch = "gh-pages" + has_outbranch = true + if !success(`git checkout $outbranch`) + has_outbranch = false + if !success(`git switch --orphan $outbranch`) + @error "Cannot create new orphaned branch $outbranch." + exit(1) + end end - end - for file in readdir(gitroot; join=true) - endswith(file, ".git") && continue - rm(file; force=true, recursive=true) - end - for file in readdir(outpath) - cp(joinpath(outpath, file), joinpath(gitroot, file)) - end - # Specify a custom domain. - write(joinpath(gitroot, "CNAME"), "docs.itensor.org") - run(`git add .`) - if success(`git commit -m 'Aggregate documentation'`) - @info "Pushing updated documentation." - if has_outbranch - run(`git push`) + for file in readdir(gitroot; join = true) + endswith(file, ".git") && continue + rm(file; force = true, recursive = true) + end + for file in readdir(outpath) + cp(joinpath(outpath, file), joinpath(gitroot, file)) + end + # Specify a custom domain. + write(joinpath(gitroot, "CNAME"), "docs.itensor.org") + run(`git add .`) + if success(`git commit -m 'Aggregate documentation'`) + @info "Pushing updated documentation." + if has_outbranch + run(`git push`) + else + run(`git push -u origin $outbranch`) + end + run(`git checkout main`) else - run(`git push -u origin $outbranch`) + @info "No changes to aggregated documentation." end - run(`git checkout main`) - else - @info "No changes to aggregated documentation." - end else - @info "Skipping deployment, 'deploy' not passed. Generated files in docs/out." ARGS - cp(outpath, joinpath(@__DIR__, "out"); force=true) + @info "Skipping deployment, 'deploy' not passed. Generated files in docs/out." ARGS + cp(outpath, joinpath(@__DIR__, "out"); force = true) end diff --git a/docs/make_index.jl b/docs/make_index.jl index cfad73d3..27a328cc 100644 --- a/docs/make_index.jl +++ b/docs/make_index.jl @@ -1,21 +1,21 @@ -using Literate: Literate using ITensorDocs: ITensorDocs +using Literate: Literate function ccq_logo(content) - include_ccq_logo = """ + include_ccq_logo = """ ```@raw html Flatiron Center for Computational Quantum Physics logo. Flatiron Center for Computational Quantum Physics logo. ``` """ - content = replace(content, "{CCQ_LOGO}" => include_ccq_logo) - return content + content = replace(content, "{CCQ_LOGO}" => include_ccq_logo) + return content end Literate.markdown( - joinpath(pkgdir(ITensorDocs), "examples", "README.jl"), - joinpath(pkgdir(ITensorDocs), "docs", "src"); - flavor=Literate.DocumenterFlavor(), - name="index", - postprocess=ccq_logo, + joinpath(pkgdir(ITensorDocs), "examples", "README.jl"), + joinpath(pkgdir(ITensorDocs), "docs", "src"); + flavor = Literate.DocumenterFlavor(), + name = "index", + postprocess = ccq_logo ) diff --git a/docs/make_readme.jl b/docs/make_readme.jl index 79b0b755..850addff 100644 --- a/docs/make_readme.jl +++ b/docs/make_readme.jl @@ -1,21 +1,21 @@ -using Literate: Literate using ITensorDocs: ITensorDocs +using Literate: Literate function ccq_logo(content) - include_ccq_logo = """ + include_ccq_logo = """ Flatiron Center for Computational Quantum Physics logo. """ - content = replace(content, "{CCQ_LOGO}" => include_ccq_logo) - return content + content = replace(content, "{CCQ_LOGO}" => include_ccq_logo) + return content end Literate.markdown( - joinpath(pkgdir(ITensorDocs), "examples", "README.jl"), - joinpath(pkgdir(ITensorDocs)); - flavor=Literate.CommonMarkFlavor(), - name="README", - postprocess=ccq_logo, + joinpath(pkgdir(ITensorDocs), "examples", "README.jl"), + joinpath(pkgdir(ITensorDocs)); + flavor = Literate.CommonMarkFlavor(), + name = "README", + postprocess = ccq_logo ) diff --git a/examples/README.jl b/examples/README.jl index e34751f5..0a144d18 100644 --- a/examples/README.jl +++ b/examples/README.jl @@ -1,5 +1,5 @@ # # ITensor ecosystem documentation -# +# # Welcome to the [ITensor ecosystem documentation](https://docs.itensor.org)! # This is an aggregation of the documentation of various packages in the ITensor ecosystem, # such as [ITensors.jl](https://docs.itensor.org/ITensors) diff --git a/test/basics/test_basics.jl b/test/basics/test_basics.jl index 6023653d..f37995d1 100644 --- a/test/basics/test_basics.jl +++ b/test/basics/test_basics.jl @@ -2,5 +2,5 @@ using ITensorDocs: ITensorDocs using Test: @test, @testset @testset "ITensorDocs" begin - # Tests go here. + # Tests go here. end diff --git a/test/runtests.jl b/test/runtests.jl index 98b2d2b8..16689fac 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -6,60 +6,67 @@ using Suppressor: Suppressor const pat = r"(?:--group=)(\w+)" arg_id = findfirst(contains(pat), ARGS) const GROUP = uppercase( - if isnothing(arg_id) - get(ENV, "GROUP", "ALL") - else - only(match(pat, ARGS[arg_id]).captures) - end, + if isnothing(arg_id) + get(ENV, "GROUP", "ALL") + else + only(match(pat, ARGS[arg_id]).captures) + end ) -"match files of the form `test_*.jl`, but exclude `*setup*.jl`" +""" +match files of the form `test_*.jl`, but exclude `*setup*.jl` +""" function istestfile(fn) - return endswith(fn, ".jl") && startswith(basename(fn), "test_") && !contains(fn, "setup") + return endswith(fn, ".jl") && startswith(basename(fn), "test_") && + !contains(fn, "setup") end -"match files of the form `*.jl`, but exclude `*_notest.jl` and `*setup*.jl`" +""" +match files of the form `*.jl`, but exclude `*_notest.jl` and `*setup*.jl` +""" function isexamplefile(fn) - return endswith(fn, ".jl") && !endswith(fn, "_notest.jl") && !contains(fn, "setup") + return endswith(fn, ".jl") && !endswith(fn, "_notest.jl") && !contains(fn, "setup") end @time begin - # tests in groups based on folder structure - for testgroup in filter(isdir, readdir(@__DIR__)) - if GROUP == "ALL" || GROUP == uppercase(testgroup) - groupdir = joinpath(@__DIR__, testgroup) - for file in filter(istestfile, readdir(groupdir)) - filename = joinpath(groupdir, file) - @eval @safetestset $file begin - include($filename) + # tests in groups based on folder structure + for testgroup in filter(isdir, readdir(@__DIR__)) + if GROUP == "ALL" || GROUP == uppercase(testgroup) + groupdir = joinpath(@__DIR__, testgroup) + for file in filter(istestfile, readdir(groupdir)) + filename = joinpath(groupdir, file) + @eval @safetestset $file begin + include($filename) + end + end end - end end - end - # single files in top folder - for file in filter(istestfile, readdir(@__DIR__)) - (file == basename(@__FILE__)) && continue # exclude this file to avoid infinite recursion - @eval @safetestset $file begin - include($file) + # single files in top folder + for file in filter(istestfile, readdir(@__DIR__)) + (file == basename(@__FILE__)) && continue # exclude this file to avoid infinite recursion + @eval @safetestset $file begin + include($file) + end end - end - # test examples - examplepath = joinpath(@__DIR__, "..", "examples") - for (root, _, files) in walkdir(examplepath) - contains(chopprefix(root, @__DIR__), "setup") && continue - for file in filter(isexamplefile, files) - filename = joinpath(root, file) - @eval begin - @safetestset $file begin - $(Expr( - :macrocall, - GlobalRef(Suppressor, Symbol("@suppress")), - LineNumberNode(@__LINE__, @__FILE__), - :(include($filename)), - )) + # test examples + examplepath = joinpath(@__DIR__, "..", "examples") + for (root, _, files) in walkdir(examplepath) + contains(chopprefix(root, @__DIR__), "setup") && continue + for file in filter(isexamplefile, files) + filename = joinpath(root, file) + @eval begin + @safetestset $file begin + $( + Expr( + :macrocall, + GlobalRef(Suppressor, Symbol("@suppress")), + LineNumberNode(@__LINE__, @__FILE__), + :(include($filename)) + ) + ) + end + end end - end end - end end diff --git a/test/test_aqua.jl b/test/test_aqua.jl index cc17d01b..d33be9ad 100644 --- a/test/test_aqua.jl +++ b/test/test_aqua.jl @@ -1,7 +1,7 @@ -using ITensorDocs: ITensorDocs using Aqua: Aqua +using ITensorDocs: ITensorDocs using Test: @testset @testset "Code quality (Aqua.jl)" begin - Aqua.test_all(ITensorDocs) + Aqua.test_all(ITensorDocs) end