diff --git a/.JuliaFormatter.toml b/.JuliaFormatter.toml new file mode 100644 index 0000000..387d4b4 --- /dev/null +++ b/.JuliaFormatter.toml @@ -0,0 +1,14 @@ +style="sciml" +align_assignment=true +align_struct_field=true +always_for_in=true +whitespace_ops_in_indices=true +remove_extra_newlines=true +always_use_return=false +whitespace_in_kwargs=false +format_docstrings=true +normalize_line_endings="unix" +trailing_comma=false +separate_kwargs_with_semicolon=true +whitespace_typedefs=false +short_to_long_function_def=false \ No newline at end of file diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000..2e89052 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,74 @@ +name: CI +on: + push: + branches: + - '**' + pull_request: + branches: + - main +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: only if it is a pull request build. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + +# needed to allow julia-actions/cache to delete old caches that it has created +permissions: + actions: write + contents: read + +jobs: + test: + name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + version: + - 'lts' + - '1' + os: + - ubuntu-latest + #- macOS-latest + #- windows-latest + arch: + - x64 + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: ${{ matrix.version }} + arch: ${{ matrix.arch }} + - name: Add Julia Registries + run: | + julia -e ' + using Pkg + Pkg.Registry.add( + RegistrySpec(url = "https://github.com/tensor4all/T4ARegistry.git") + )' + - uses: julia-actions/cache@v2 + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-runtest@v1 + continue-on-error: ${{ matrix.version == 'nightly' }} + - uses: julia-actions/julia-processcoverage@v1 + - uses: codecov/codecov-action@v3 + docs: + name: Documentation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: '1' + - name: Add Julia Registries + run: | + julia -e ' + using Pkg + Pkg.Registry.add( + RegistrySpec(url = "https://github.com/tensor4all/T4ARegistry.git") + )' + - uses: julia-actions/julia-buildpkg@v1 + - uses: julia-actions/julia-docdeploy@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} 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/TagBot.yml b/.github/workflows/TagBot.yml new file mode 100644 index 0000000..4bad0ec --- /dev/null +++ b/.github/workflows/TagBot.yml @@ -0,0 +1,33 @@ +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 }} + # Edit the following line to reflect the actual name of the GitHub Secret containing your private key + ssh: ${{ secrets.DOCUMENTER_KEY }} + # ssh: ${{ secrets.NAME_OF_MY_SSH_PRIVATE_KEY_SECRET }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9bc2802 --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +.* +*~ +\#*\# + +!.gitignore +!/.github/ +!/.gitlab* + +*.jl.*.cov +*.jl.cov +*.jl.mem +.DS_Store +/Manifest.toml +/notebook*/ +/docs/Manifest.toml +/docs/build/ +docs/build +__pycache__/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..18ed248 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,99 @@ +before_script: + - which git || (apt-get update -qq && apt-get install --no-install-recommends -qqqy git) + - git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/".insteadOf "git@gitlab.com:" + - git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/".insteadOf "https://gitlab.com/" --add + - | + julia -e ' + using Pkg + Pkg.Registry.add( + RegistrySpec(url = "https://github.com/JuliaRegistries/General.git") + ) + Pkg.Registry.add( + RegistrySpec(url = "https://gitlab.com/tensors4fields/tensors4fieldsregistry.git") + )' + +variables: + CI_JULIA_CACHE_DIR: ${CI_PROJECT_DIR}/julia_pkg + JULIA_DEPOT_PATH: ${CI_JULIA_CACHE_DIR} +cache: + key: + files: + - Project.toml + - docs/Project.toml + prefix: ${CI_JOB_NAME} + paths: + - ${CI_JULIA_CACHE_DIR} + +.script: + script: + - | + julia --project=@. -e ' + using Pkg + Pkg.build() + Pkg.test(coverage=true)' +.coverage: + coverage: /Test coverage (\d+\.\d+%)/ + after_script: + - | + julia -e ' + using Pkg + Pkg.add("Coverage") + using Coverage + c, t = get_summary(process_folder()) + using Printf + @printf "Test coverage %.2f%%\n" 100c / t' +Julia test: + image: julia:${JULIA_VERSION} + extends: + - .script + - .coverage + parallel: + matrix: + - JULIA_VERSION: + - "1.9" + - "1" # latest stable version +.doctest: + script: + - | + julia --project=docs -e ' + using Pkg + Pkg.develop(PackageSpec(path=pwd())) + Pkg.instantiate() + using Documenter: doctest + using Quantics + doctest(Quantics) + include("docs/make.jl")' +doctest: + image: julia:1.6 + extends: + - .doctest +pages: + image: julia:1.6 + stage: deploy + extends: + - .doctest + after_script: + - mkdir -p public + - mv docs/build public/dev + artifacts: + paths: + - public + only: + - main + +CompatHelper: + image: julia:1 # Set to the Julia version you want to use + rules: + - if: $CI_PIPELINE_SOURCE == "schedule" + script: + - | + julia --color=yes -e " + import Pkg; + name = \"CompatHelper\"; + uuid = \"aa819f21-2bde-4658-8897-bab36330d9b7\"; + version = \"3\"; + Pkg.add(; name, uuid, version)" + - | + julia --color=yes -e " + import CompatHelper; + CompatHelper.main(;use_existing_registries=true)" diff --git a/.gitmodules b/.gitmodules index b8b00f8..b6e713a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -43,3 +43,14 @@ [submodule "PartitionedMPSs.jl"] path = PartitionedMPSs.jl url = git@github.com:tensor4all/PartitionedMPSs.jl.git +[submodule "T4APartitionedMPSs.jl"] + path = T4APartitionedMPSs.jl + url = https://github.com/tensor4all/T4APartitionedMPSs.jl +[submodule "T4AQuantics.jl"] + url = git@github.com:tensor4all/T4AQuantics.jl.git + path = T4AQuantics.jl + branch = develop +[submodule "T4ATCIAlgorithms.jl"] + path = T4ATCIAlgorithms.jl + url = https://github.com/tensor4all/T4ATCIAlgorithms.jl + branch = develop diff --git a/AGENTS.md b/AGENTS.md index 28c9b03..b8f8773 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -12,10 +12,36 @@ - Run tests for a specific package by navigating to its directory and running `julia --project=. -e 'using Pkg; Pkg.test()'` or `julia --project=. test/runtests.jl` +- **When running tests, always redirect stdout and stderr to files and use tee for real-time output**: **Always save test output to files** - this is critical because test output contains detailed error messages, stack traces, and diagnostic information that you'll need for debugging. Without saving to files, you would need to run tests twice: once to see what happened, and again to capture the details. Using `tee` allows you to see progress in real-time while simultaneously saving everything to files. Example: + ```bash + julia --project=. test/runtests.jl 2>&1 | tee test_output.log + ``` + Or to separate stdout and stderr while still seeing both in real-time: + ```bash + julia --project=. test/runtests.jl > >(tee test_stdout.log) 2> >(tee test_stderr.log >&2) + ``` + **Important**: Always save test output to files. The saved logs are essential for debugging failures, understanding test behavior, and reviewing detailed error messages without re-running tests. + - For debugging specific tests, it's more efficient to run only the relevant test file. For packages using `include()` statements in `runtests.jl` (like TensorCrossInterpolation.jl), comment out unnecessary includes and run only the test file you're debugging - Some libraries use ReTestItems as their test framework (e.g., Quantics.jl, QuanticsGrids.jl, TreeTCI.jl, SimpleTensorTrains.jl). However, ReTestItems has compatibility issues with libraries that use Distributed for parallel computation, so those libraries use the standard Test.jl framework instead +- **For ReTestItems packages, you can run individual test files**: ReTestItems supports running specific test files by passing file paths to `runtests()`. This is useful for debugging specific tests without running the entire test suite. Examples: + ```bash + # Run a specific test file + julia --project=. -e "using ReTestItems; runtests(\"test/binaryop_tests.jl\")" + + # Run multiple specific test files + julia --project=. -e "using ReTestItems; runtests(\"test/binaryop_tests.jl\", \"test/mul_tests.jl\")" + + # Run with specific options (e.g., single worker for debugging) + julia --project=. -e "using ReTestItems; runtests(\"test/binaryop_tests.jl\"; nworkers=1)" + ``` + Note: The file paths should be relative to the package root directory. Always redirect output to files when debugging: + ```bash + julia --project=. -e "using ReTestItems; runtests(\"test/binaryop_tests.jl\")" 2>&1 | tee test_binaryop.log + ``` + - If a package has a `.JuliaFormatter.toml` file, follow its formatting rules. Otherwise, follow standard Julia style guidelines - When making changes that affect multiple packages, consider the dependency graph and test affected packages accordingly diff --git a/ITensorMPS.jl b/ITensorMPS.jl new file mode 160000 index 0000000..56f0cbf --- /dev/null +++ b/ITensorMPS.jl @@ -0,0 +1 @@ +Subproject commit 56f0cbf1b0d30dd5a6f25f7d4fbd248b22f38160 diff --git a/T4AITensorCompat.jl b/T4AITensorCompat.jl index f6093d5..34536ca 160000 --- a/T4AITensorCompat.jl +++ b/T4AITensorCompat.jl @@ -1 +1 @@ -Subproject commit f6093d5212ea553bfdd3b506eb253a0b8668a62d +Subproject commit 34536ca850c1aa54891d6befdc30839d8fc6df25 diff --git a/T4APartitionedMPSs.jl b/T4APartitionedMPSs.jl new file mode 160000 index 0000000..714bcf1 --- /dev/null +++ b/T4APartitionedMPSs.jl @@ -0,0 +1 @@ +Subproject commit 714bcf1f500890c42dc7c280edb06b821aea244b diff --git a/T4AQuantics.jl b/T4AQuantics.jl new file mode 160000 index 0000000..f4c78f9 --- /dev/null +++ b/T4AQuantics.jl @@ -0,0 +1 @@ +Subproject commit f4c78f99a9dc02ee376c1fb4bb51eb31faba548f diff --git a/T4ARegistrator.jl b/T4ARegistrator.jl index c2725e3..0e6bc4c 160000 --- a/T4ARegistrator.jl +++ b/T4ARegistrator.jl @@ -1 +1 @@ -Subproject commit c2725e34836053733243a7b63d7e8fbeef7b5d25 +Subproject commit 0e6bc4c441e4ab04a44cf302a649fb1e1bf7bba4 diff --git a/T4ARegistry b/T4ARegistry index 8c14129..26a29de 160000 --- a/T4ARegistry +++ b/T4ARegistry @@ -1 +1 @@ -Subproject commit 8c14129ad00043cc4f8ba0ea63c2c2f0861e8b88 +Subproject commit 26a29de10602d4c6c897e4ad037fbf96d0d5bd9f diff --git a/T4ATCIAlgorithms.jl b/T4ATCIAlgorithms.jl new file mode 160000 index 0000000..08e5296 --- /dev/null +++ b/T4ATCIAlgorithms.jl @@ -0,0 +1 @@ +Subproject commit 08e529622301aac76469ad2aa4d4f7510ae503b6 diff --git a/TensorCrossInterpolation.jl b/TensorCrossInterpolation.jl index dbd2e23..3bc3fc6 160000 --- a/TensorCrossInterpolation.jl +++ b/TensorCrossInterpolation.jl @@ -1 +1 @@ -Subproject commit dbd2e233cc81e8c3e75e34aa30e62785c1567f91 +Subproject commit 3bc3fc6b1073c6b7ec82154c3e90a64552a7866c