diff --git a/.JuliaFormatter.toml b/.JuliaFormatter.toml new file mode 100644 index 0000000..4c49a86 --- /dev/null +++ b/.JuliaFormatter.toml @@ -0,0 +1,3 @@ +# See https://domluna.github.io/JuliaFormatter.jl/stable/ for a list of options +style = "blue" +indent = 2 diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.md b/.github/ISSUE_TEMPLATE/BUG_REPORT.md new file mode 100644 index 0000000..2b39177 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.md @@ -0,0 +1,62 @@ +--- +name: FusionTensors.jl bug report +about: Create a bug report to help us improve FusionTensors.jl +title: "[BUG] YOUR SHORT DESCRIPTION OF THE BUG HERE" +labels: ["bug"] +assignees: '' + +--- + +**Description of bug** + +Please give a brief description of the bug or unexpected behavior here. + +**Minimal code demonstrating the bug or unexpected behavior** + +If applicable, provide a minimal code that can be run to demonstrate the bug or unexpected behavior. + +If you are unable to construct a minimal code that demonstrates the bug or unexpected behavior, provide detailed steps for how to reproduce the behavior you are seeing. + +
Minimal runnable code

+ +```julia +[YOUR MINIMAL RUNNABLE CODE HERE] +``` + +

+ + +**Expected output or behavior** + +Describe what you expected to happen. + +If you provided a minimal code that can be run to demonstrate the bug or unexpected behavior, describe what you expected the output would be. + + +**Actual output or behavior** + +Describe what actually happened. + +If you provided a minimal code that demonstrates the bug or unexpected behavior, provide the output you get from that code. If the code leads to an error or warning, include the full error or warning below. + +
Output of minimal runnable code

+ +```julia +[OUTPUT OF YOUR MINIMAL RUNNABLE CODE HERE] +``` + +

+ + +**Version information** + + - Output from `versioninfo()`: +```julia +julia> versioninfo() +[YOUR OUTPUT HERE] +``` + - Output from `using Pkg; Pkg.status("FusionTensors")`: +```julia +julia> using Pkg; Pkg.status("FusionTensors") +[YOUR OUTPUT HERE] +``` diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md new file mode 100644 index 0000000..85db8d4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md @@ -0,0 +1,24 @@ +--- +name: FusionTensors.jl feature request +about: Suggest an idea for FusionTensors.jl +title: "[ENHANCEMENT] YOUR SHORT DESCRIPTION OF THE FEATURE REQUEST HERE" +labels: ["enhancement"] +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** + +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** + +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** + +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** + +Add any other context or screenshots about the feature request here. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..1b89495 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,42 @@ +# Description + +Please include a summary of the change and which issue is fixed (if applicable). Please also include relevant motivation and context. List any dependencies that are required for this change. + +Fixes #(issue) + +If practical and applicable, please include a minimal demonstration of the previous behavior and new behavior below. + +
Minimal demonstration of previous behavior

+ +```julia +[YOUR MINIMAL DEMONSTRATION OF PREVIOUS BEHAVIOR] +``` + +

+ +
Minimal demonstration of new behavior

+ +```julia +[YOUR MINIMAL DEMONSTRATION OF NEW BEHAVIOR] +``` + +

+ +# How Has This Been Tested? + +Please add tests that verify your changes to a file in the `test` directory. + +Please give a summary of the tests that you added to verify your changes. + +- [ ] Test A +- [ ] Test B + +# Checklist: + +- [ ] My code follows the style guidelines of this project. Please run `using JuliaFormatter; format(".")` in the base directory of the repository (`~/.julia/dev/FusionTensors`) to format your code according to our style guidelines. +- [ ] I have performed a self-review of my own code. +- [ ] I have commented my code, particularly in hard-to-understand areas. +- [ ] I have added tests that verify the behavior of the changes I made. +- [ ] I have made corresponding changes to the documentation. +- [ ] My changes generate no new warnings. +- [ ] Any dependent changes have been merged and published in downstream modules. diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..700707c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +# 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 + schedule: + interval: "weekly" diff --git a/.github/workflows/CompatHelper.yml b/.github/workflows/CompatHelper.yml new file mode 100644 index 0000000..cba9134 --- /dev/null +++ b/.github/workflows/CompatHelper.yml @@ -0,0 +1,16 @@ +name: CompatHelper +on: + schedule: + - cron: 0 0 * * * + workflow_dispatch: +jobs: + CompatHelper: + runs-on: ubuntu-latest + steps: + - name: Pkg.add("CompatHelper") + run: julia -e 'using Pkg; Pkg.add("CompatHelper")' + - name: CompatHelper.main() + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }} + run: julia -e 'using CompatHelper; CompatHelper.main()' diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml new file mode 100644 index 0000000..75c7be5 --- /dev/null +++ b/.github/workflows/Documentation.yml @@ -0,0 +1,22 @@ +name: "Documentation" + +on: + push: + branches: + - main + tags: '*' + pull_request: + schedule: + - cron: '1 4 * * 4' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch || github.ref != 'refs/tags/v*' }} + +jobs: + build-and-deploy-docs: + name: "Documentation" + uses: "ITensor/ITensorActions/.github/workflows/Documentation.yml@main" + with: + localregistry: https://github.com/ITensor/ITensorRegistry.git + secrets: "inherit" diff --git a/.github/workflows/FormatCheck.yml b/.github/workflows/FormatCheck.yml new file mode 100644 index 0000000..3f78afc --- /dev/null +++ b/.github/workflows/FormatCheck.yml @@ -0,0 +1,13 @@ +name: "Format Check" + +on: + push: + branches: + - 'main' + tags: '*' + pull_request: + +jobs: + format-check: + name: "Format Check" + uses: "ITensor/ITensorActions/.github/workflows/FormatCheck.yml@main" diff --git a/.github/workflows/LiterateCheck.yml b/.github/workflows/LiterateCheck.yml new file mode 100644 index 0000000..2ca5f27 --- /dev/null +++ b/.github/workflows/LiterateCheck.yml @@ -0,0 +1,15 @@ +name: "Literate Check" + +on: + push: + branches: + - '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 diff --git a/.github/workflows/Register.yml b/.github/workflows/Register.yml new file mode 100644 index 0000000..5b7cd3b --- /dev/null +++ b/.github/workflows/Register.yml @@ -0,0 +1,16 @@ +name: Register Package +on: + workflow_dispatch: + inputs: + version: + description: Version to register or component to bump + required: true +jobs: + register: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: julia-actions/RegisterAction@latest + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/TagBot.yml b/.github/workflows/TagBot.yml new file mode 100644 index 0000000..0cd3114 --- /dev/null +++ b/.github/workflows/TagBot.yml @@ -0,0 +1,31 @@ +name: TagBot +on: + issue_comment: + types: + - 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 +jobs: + TagBot: + if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' + runs-on: ubuntu-latest + steps: + - uses: JuliaRegistries/TagBot@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + ssh: ${{ secrets.DOCUMENTER_KEY }} diff --git a/.github/workflows/Tests.yml b/.github/workflows/Tests.yml new file mode 100644 index 0000000..5a0a306 --- /dev/null +++ b/.github/workflows/Tests.yml @@ -0,0 +1,42 @@ +name: Tests +on: + push: + branches: + - 'master' + - 'main' + - 'release-' + tags: '*' + paths-ignore: + - '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/') }} + +jobs: + tests: + name: "Tests" + strategy: + fail-fast: false + matrix: + version: + - 'lts' # minimal supported version + - '1' # latest released Julia version + # group: + # - 'core' + # - 'optional' + os: + - 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 + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..10593a9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +*.jl.*.cov +*.jl.cov +*.jl.mem +*.o +*.swp +.DS_Store +.benchmarkci +.tmp +.vscode/ +Manifest.toml +benchmark/*.json +docs/Manifest.toml +docs/build/ +docs/src/index.md diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..bff1fb7 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,13 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.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/qiaojunfeng/pre-commit-julia-format + rev: v0.2.0 + hooks: + - id: julia-format diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7f5c8c6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 ITensor developers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Project.toml b/Project.toml new file mode 100644 index 0000000..5bfbcc0 --- /dev/null +++ b/Project.toml @@ -0,0 +1,19 @@ +name = "FusionTensors" +uuid = "e16ca583-1f51-4df0-8e12-57d32947d33e" +authors = ["ITensor developers and contributors"] +version = "0.1.0" + +[deps] +Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" + +[compat] +Aqua = "0.8.9" +Test = "1.10" +julia = "1.10" + +[extras] +Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[targets] +test = ["Aqua", "Test"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..c0ddcbf --- /dev/null +++ b/README.md @@ -0,0 +1,40 @@ +# FusionTensors.jl + +[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://ITensor.github.io/FusionTensors.jl/stable/) +[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://ITensor.github.io/FusionTensors.jl/dev/) +[![Build Status](https://github.com/ITensor/FusionTensors.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/ITensor/FusionTensors.jl/actions/workflows/CI.yml?query=branch%3Amain) +[![Coverage](https://codecov.io/gh/ITensor/FusionTensors.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/ITensor/FusionTensors.jl) +[![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle) +[![Aqua](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl) + +## Installation instructions + +This package resides in the `ITensor/ITensorRegistry` local registry. +In order to install, simply add that registry through your package manager. +This step is only required once. + +```julia +julia> using Pkg: Pkg + +julia> Pkg.Registry.add(url="https://github.com/ITensor/ITensorRegistry") +``` + +Then, the package can be added as usual through the package manager: + + +```julia +julia> Pkg.add("FusionTensors") +``` + +## Examples + +````julia +using FusionTensors: FusionTensors +```` + +Examples go here. + +--- + +*This page was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).* + diff --git a/benchmark/benchmarks.jl b/benchmark/benchmarks.jl new file mode 100644 index 0000000..7c15892 --- /dev/null +++ b/benchmark/benchmarks.jl @@ -0,0 +1,7 @@ +using FusionTensors +using BenchmarkTools + +SUITE = BenchmarkGroup() +SUITE["rand"] = @benchmarkable rand(10) + +# Write your benchmarks here. diff --git a/docs/Project.toml b/docs/Project.toml new file mode 100644 index 0000000..87f6e67 --- /dev/null +++ b/docs/Project.toml @@ -0,0 +1,4 @@ +[deps] +FusionTensors = "e16ca583-1f51-4df0-8e12-57d32947d33e" +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +Literate = "98b081ad-f1c9-55d3-8b20-4c87d4299306" diff --git a/docs/make.jl b/docs/make.jl new file mode 100644 index 0000000..0af4303 --- /dev/null +++ b/docs/make.jl @@ -0,0 +1,22 @@ +using FusionTensors: FusionTensors +using Documenter: Documenter, DocMeta, deploydocs, makedocs + +DocMeta.setdocmeta!(FusionTensors, :DocTestSetup, :(using FusionTensors); recursive=true) + +include("make_index.jl") + +makedocs(; + modules=[FusionTensors], + authors="ITensor developers and contributors", + sitename="FusionTensors.jl", + format=Documenter.HTML(; + canonical="https://ITensor.github.io/FusionTensors.jl", + edit_link="main", + assets=String[], + ), + pages=["Home" => "index.md"], +) + +deploydocs(; + repo="github.com/ITensor/FusionTensors.jl", devbranch="main", push_preview=true +) diff --git a/docs/make_index.jl b/docs/make_index.jl new file mode 100644 index 0000000..996deca --- /dev/null +++ b/docs/make_index.jl @@ -0,0 +1,9 @@ +using Literate: Literate +using FusionTensors: FusionTensors + +Literate.markdown( + joinpath(pkgdir(FusionTensors), "examples", "README.jl"), + joinpath(pkgdir(FusionTensors), "docs", "src"); + flavor=Literate.DocumenterFlavor(), + name="index", +) diff --git a/docs/make_readme.jl b/docs/make_readme.jl new file mode 100644 index 0000000..4f44f07 --- /dev/null +++ b/docs/make_readme.jl @@ -0,0 +1,9 @@ +using Literate: Literate +using FusionTensors: FusionTensors + +Literate.markdown( + joinpath(pkgdir(FusionTensors), "examples", "README.jl"), + joinpath(pkgdir(FusionTensors)); + flavor=Literate.CommonMarkFlavor(), + name="README", +) diff --git a/examples/Project.toml b/examples/Project.toml new file mode 100644 index 0000000..cf562c8 --- /dev/null +++ b/examples/Project.toml @@ -0,0 +1,2 @@ +[deps] +FusionTensors = "e16ca583-1f51-4df0-8e12-57d32947d33e" diff --git a/examples/README.jl b/examples/README.jl new file mode 100644 index 0000000..165eaf9 --- /dev/null +++ b/examples/README.jl @@ -0,0 +1,33 @@ +# # FusionTensors.jl +# +# [![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://ITensor.github.io/FusionTensors.jl/stable/) +# [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://ITensor.github.io/FusionTensors.jl/dev/) +# [![Build Status](https://github.com/ITensor/FusionTensors.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/ITensor/FusionTensors.jl/actions/workflows/CI.yml?query=branch%3Amain) +# [![Coverage](https://codecov.io/gh/ITensor/FusionTensors.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/ITensor/FusionTensors.jl) +# [![Code Style: Blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle) +# [![Aqua](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl) + +# ## Installation instructions + +# This package resides in the `ITensor/ITensorRegistry` local registry. +# In order to install, simply add that registry through your package manager. +# This step is only required once. +#= +```julia +julia> using Pkg: Pkg + +julia> Pkg.Registry.add(url="https://github.com/ITensor/ITensorRegistry") +``` +=# +# Then, the package can be added as usual through the package manager: + +#= +```julia +julia> Pkg.add("FusionTensors") +``` +=# + +# ## Examples + +using FusionTensors: FusionTensors +# Examples go here. diff --git a/src/FusionTensors.jl b/src/FusionTensors.jl new file mode 100644 index 0000000..336ea97 --- /dev/null +++ b/src/FusionTensors.jl @@ -0,0 +1,5 @@ +module FusionTensors + +# Write your package code here. + +end diff --git a/test/Project.toml b/test/Project.toml new file mode 100644 index 0000000..9ae7c9d --- /dev/null +++ b/test/Project.toml @@ -0,0 +1,4 @@ +[deps] +FusionTensors = "e16ca583-1f51-4df0-8e12-57d32947d33e" +Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" diff --git a/test/runtests.jl b/test/runtests.jl new file mode 100644 index 0000000..3c16373 --- /dev/null +++ b/test/runtests.jl @@ -0,0 +1,12 @@ +@eval module $(gensym()) +using Test: @testset + +@testset "FusionTensors.jl" begin + filenames = filter(readdir(@__DIR__)) do f + startswith("test_")(f) && endswith(".jl")(f) + end + @testset "Test $filename" for filename in filenames + include(filename) + end +end +end diff --git a/test/test_aqua.jl b/test/test_aqua.jl new file mode 100644 index 0000000..72f94bc --- /dev/null +++ b/test/test_aqua.jl @@ -0,0 +1,15 @@ +@eval module $(gensym()) +using FusionTensors: FusionTensors +using Aqua: Aqua +using Test: @testset + +@testset "Code quality (Aqua.jl)" begin + Aqua.test_ambiguities([FusionTensors]) + Aqua.test_unbound_args(FusionTensors) + Aqua.test_undefined_exports(FusionTensors) + Aqua.test_project_extras(FusionTensors) + Aqua.test_deps_compat(FusionTensors) + Aqua.test_piracies(FusionTensors) + Aqua.test_persistent_tasks(FusionTensors) +end +end diff --git a/test/test_basics.jl b/test/test_basics.jl new file mode 100644 index 0000000..4eeedd4 --- /dev/null +++ b/test/test_basics.jl @@ -0,0 +1,8 @@ +@eval module $(gensym()) +using FusionTensors: FusionTensors +using Test: @test, @testset + +@testset "FusionTensors" begin + # Tests go here. +end +end diff --git a/test/test_examples.jl b/test/test_examples.jl new file mode 100644 index 0000000..380a628 --- /dev/null +++ b/test/test_examples.jl @@ -0,0 +1,8 @@ +@eval module $(gensym()) +using FusionTensors: FusionTensors +using Test: @test, @testset + +@testset "examples" begin + include(joinpath(pkgdir(FusionTensors), "examples", "README.jl")) +end +end