diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ff6499d --- /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" \ No newline at end of file diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..6bf389d --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,15 @@ +## Checklist +Thank you for contributing to Tutorials for Quantum Toolbox in `Julia`! Please make sure you have finished the following tasks before opening the PR. + +- [ ] Please read [Contributing to QuantumToolbox.jl](https://qutip.org/QuantumToolbox.jl/stable/resources/contributing). +- [ ] All tutorials were able to render locally by running: `make render`. + +Request for a review after you have completed all the tasks. If you have not finished them all, you can also open a [Draft Pull Request](https://github.blog/2019-02-14-introducing-draft-pull-requests/) to let the others know this on-going work. + +## Description +Describe the proposed change here. + +## Related issues or PRs +Please mention the related issues or PRs here. If the PR fixes an issue, use the keyword close/closes/closed/fix/fixes/fixed/resolve/resolves/resolved followed by the issue id, e.g. fix #[id] + +## Additional context diff --git a/.github/workflows/SpellCheck.yml b/.github/workflows/SpellCheck.yml new file mode 100644 index 0000000..d513826 --- /dev/null +++ b/.github/workflows/SpellCheck.yml @@ -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@v1.28.3 \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..e39cc56 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,54 @@ +name: Quarto Build + +on: # either one of the following four cases + workflow_dispatch: # manually trigger + + schedule: + - cron: '0 0 * * 0' # weekly (every Sunday) + + push: + branches: main + + pull_request: + branches: + - main + types: + - opened + - reopened + - synchronize + - ready_for_review + +jobs: + build-deploy: + runs-on: ubuntu-latest + permissions: + actions: write # needed to allow julia-actions/cache to delete old caches that it has created + contents: write # needed for Quarto render + if: ${{ !github.event.pull_request.draft }} + steps: + - uses: actions/checkout@v4 + - name: Set up Quarto + uses: quarto-dev/quarto-actions/setup@v2 + - uses: julia-actions/setup-julia@v2 + with: + version: '1' + - uses: julia-actions/cache@v2 + - uses: julia-actions/julia-buildpkg@v1 + with: + precompile: true + - uses: cardinalby/export-env-action@v1 + with: + envFile: '_environment' + expand: 'true' + - name: Quarto Render + uses: quarto-dev/quarto-actions/render@v2 + with: + to: html + - name: Quarto Publish + if: ${{ github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }} + uses: quarto-dev/quarto-actions/publish@v2 + with: + render: 'false' # rendered in the previous step already + target: gh-pages + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index b91756c..ecd07fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,14 @@ +.DS_Store + # Files generated by invoking Julia with --code-coverage *.jl.cov *.jl.*.cov - -# Files generated by invoking Julia with --track-allocation *.jl.mem +Manifest.toml + +.vscode + # System-specific files and directories generated by the BinaryProvider and BinDeps packages # They contain absolute paths specific to the host computer, and so should not be committed deps/deps.jl @@ -13,17 +17,14 @@ deps/downloads/ deps/usr/ deps/src/ -# Build artifacts for creating documentation generated by the Documenter package -docs/build/ -docs/site/ - -# File generated by Pkg, the package manager, based on a corresponding Project.toml -# It records a fixed state of all packages used by the project. As such, it should not be -# committed for packages, but should be committed for applications that require a static -# environment. -# Manifest.toml +.ipynb_checkpoints +*.ipynb pyenv/ /.quarto/ +/_freeze/ /_site/ /_output/ +*.html +*.json +/site_libs/ \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..ddf531d --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,25 @@ +# Contributor Covenant Code of Conduct + +As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. + +We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery +* Personal attacks +* Trolling or insulting/derogatory comments +* Public or private harassment +* Publishing other's private information, such as physical or electronic addresses, without explicit permission +* Other unethical or unprofessional conduct + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team. + +This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. + +This Code of Conduct is adapted from the Contributor Covenant , version 1.2.0, available at https://www.contributor-covenant.org/version/1/2/0/code-of-conduct.html + +[homepage]: https://contributor-covenant.org +[version]: https://contributor-covenant.org/version/1/2/ diff --git a/LICENSE b/LICENSE index a6cdcb3..d9cb6f4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,29 @@ -MIT License +BSD 3-Clause License -Copyright (c) 2025 QuTiP +Copyright (c) 2025, QuTiP developers and contributors. +All rights reserved. -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: +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. -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. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..896dbd1 --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +JULIA:=julia +QUARTO:=quarto + +include _environment + +default: help + +render: + ${JULIA} --project=@. -e 'import Pkg; Pkg.instantiate(); Pkg.resolve(); Pkg.precompile(); using QuantumToolbox, HierarchicalEOM;' + ${JULIA} --project=@. -e 'using QuantumToolbox, HierarchicalEOM;' + ${QUARTO} render + +preview: + ${QUARTO} preview + +all: render preview + +help: + @echo "The following make commands are available:" + @echo " - make render: render the tutorial files" + @echo " - make preview: start a local site of tutorials" + @echo " - make all: run every commands in the above order" + +.PHONY: default render preview all help diff --git a/Project.toml b/Project.toml new file mode 100644 index 0000000..78c0f50 --- /dev/null +++ b/Project.toml @@ -0,0 +1,4 @@ +[deps] +CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" +HierarchicalEOM = "a62dbcb7-80f5-4d31-9a88-8b19fd92b128" +QuantumToolbox = "6c2fb7c5-b903-41d2-bc5e-5a7c320b9fab" diff --git a/QuantumToolbox.jl/jaynes_cummings.qmd b/QuantumToolbox.jl/jaynes_cummings.qmd index e69de29..e867028 100644 --- a/QuantumToolbox.jl/jaynes_cummings.qmd +++ b/QuantumToolbox.jl/jaynes_cummings.qmd @@ -0,0 +1,13 @@ +--- +title: "Jaynes Cummings Model" +# subtitle: "" +author: Alberto Mercurio + +engine: julia +--- + +```{julia} +using QuantumToolbox + +QuantumToolbox.versioninfo() +``` \ No newline at end of file diff --git a/README.md b/README.md index a2abc58..54241df 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,47 @@ -# qutip-julia-tutorials -QuantumToolbox.jl and HierarchicalEOM.jl Tutorials +# Tutorials for Quantum Toolbox in `Julia` -## How to build the Website +[![tutorials](https://img.shields.io/badge/tutorials-stable-blue.svg)](https://qutip.org/qutip-julia-tutorials/) +[![Quarto Build](https://github.com/qutip/qutip-julia-tutorials/actions/workflows/publish.yml/badge.svg)](https://github.com/qutip/qutip-julia-tutorials/actions/workflows/publish.yml) -The website is built using [Quarto](https://quarto.org). The steps to build the website are: +This repositories collects tutorials of different complexity for using quantum toolbox in [`Julia`](https://julialang.org/). The tutorials of the following packages are included: -1. Load the environment variables: `source _environment` -2. Run Quarto: `quarto publish gh-pages --no-browser` +- [`QuantumToolbox.jl`](https://github.com/qutip/QuantumToolbox.jl) +- [`HierarchicalEOM.jl`](https://github.com/qutip/HierarchicalEOM.jl) + +## How to build the tutorials locally ? + +The tutorials are built upon [Quarto](https://quarto.org). + +After installing both [`Julia`](https://julialang.org/) and [Quarto](https://quarto.org), the steps to build the tutorials are: + +> [!NOTE] +> All the following commands should be run under the root folder of this repository: `/path/to/qutip-julia-tutorials/` + +### First, render the files: + +```shell +make render +``` +or +```shell +source _environment +julia --project=@. -e 'import Pkg; Pkg.instantiate(); Pkg.resolve(); Pkg.precompile()' +julia --project=@. -e 'using QuantumToolbox, HierarchicalEOM;' +quarto render +``` + +### Second, preview it on a local site: + +```shell +make preview +``` +or +```shell +quarto preview +``` + +## Contributing + +You are most welcome to contribute to the tutorials development by forking this repository and sending pull requests (PRs) at the issues page. You can also help out with users' questions, or discuss proposed changes in the [QuTiP discussion group](https://groups.google.com/g/qutip). + +For more information about contribution, including technical advice, please see the [Contributing to QuantumToolbox.jl](https://qutip.org/QuantumToolbox.jl/stable/resources/contributing) section of the documentation. diff --git a/_environment b/_environment index f7a717d..388ce63 100644 --- a/_environment +++ b/_environment @@ -1,3 +1 @@ JULIA_NUM_THREADS=16 -JULIA_CONDAPKG_BACKEND=Null -JULIA_PYTHONCALL_EXE=pyenv/bin/python diff --git a/_freeze/index/execute-results/html.json b/_freeze/index/execute-results/html.json deleted file mode 100644 index a9da342..0000000 --- a/_freeze/index/execute-results/html.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "hash": "a1991cd89ec3e4653fb10de227a129f6", - "result": { - "engine": "julia", - "markdown": "---\ntitle: \"QuantumToolbox.jl and HierarchicalEOM.jl Tutorials\"\n# subtitle: \"\"\nauthor: Alberto Mercurio\n\nengine: julia\n---\n\n::: {#2 .cell execution_count=1}\n``` {.julia .cell-code}\nusing InteractiveUtils\n\nversioninfo()\n```\n\n::: {.cell-output .cell-output-stdout}\n```\nJulia Version 1.11.2\nCommit 5e9a32e7af2 (2024-12-01 20:02 UTC)\nBuild Info:\n Official https://julialang.org/ release\nPlatform Info:\n OS: macOS (arm64-apple-darwin24.0.0)\n CPU: 8 × Apple M3\n WORD_SIZE: 64\n LLVM: libLLVM-16.0.6 (ORCJIT, apple-m2)\nThreads: 16 default, 0 interactive, 4 GC (on 4 virtual cores)\nEnvironment:\n JULIA_PYTHONCALL_EXE = pyenv/bin/python\n JULIA_NUM_THREADS = 16\n JULIA_CONDAPKG_BACKEND = Null\n JULIA_LOAD_PATH = @:@stdlib\n```\n:::\n:::\n\n\n", - "supporting": [ - "index_files" - ], - "filters": [], - "includes": {} - } -} \ No newline at end of file diff --git a/_freeze/site_libs/clipboard/clipboard.min.js b/_freeze/site_libs/clipboard/clipboard.min.js deleted file mode 100644 index 1103f81..0000000 --- a/_freeze/site_libs/clipboard/clipboard.min.js +++ /dev/null @@ -1,7 +0,0 @@ -/*! - * clipboard.js v2.0.11 - * https://clipboardjs.com/ - * - * Licensed MIT © Zeno Rocha - */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.ClipboardJS=e():t.ClipboardJS=e()}(this,function(){return n={686:function(t,e,n){"use strict";n.d(e,{default:function(){return b}});var e=n(279),i=n.n(e),e=n(370),u=n.n(e),e=n(817),r=n.n(e);function c(t){try{return document.execCommand(t)}catch(t){return}}var a=function(t){t=r()(t);return c("cut"),t};function o(t,e){var n,o,t=(n=t,o="rtl"===document.documentElement.getAttribute("dir"),(t=document.createElement("textarea")).style.fontSize="12pt",t.style.border="0",t.style.padding="0",t.style.margin="0",t.style.position="absolute",t.style[o?"right":"left"]="-9999px",o=window.pageYOffset||document.documentElement.scrollTop,t.style.top="".concat(o,"px"),t.setAttribute("readonly",""),t.value=n,t);return e.container.appendChild(t),e=r()(t),c("copy"),t.remove(),e}var f=function(t){var e=1