Skip to content

Commit 56be2d4

Browse files
Add links to Binder (#42)
1 parent e921df0 commit 56be2d4

File tree

19 files changed

+290
-2
lines changed

19 files changed

+290
-2
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Build container image
2+
3+
permissions:
4+
contents: write
5+
packages: write
6+
7+
on:
8+
workflow_run:
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
15+
- name: checkout files in repo
16+
uses: actions/checkout@v4
17+
with:
18+
ref: notebooks
19+
20+
- name: update jupyter dependencies with repo2docker
21+
uses: jupyterhub/repo2docker-action@master
22+
with:
23+
DOCKER_USERNAME: ${{github.actor}}
24+
DOCKER_PASSWORD: ${{secrets.GITHUB_TOKEN}}
25+
BINDER_CACHE: true
26+
DOCKER_REGISTRY: "ghcr.io"
27+
IMAGE_NAME: "qutip/quantumtoolbox-jl-binder"
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Sync Notebooks
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- 'QuantumToolbox.jl/**/*.qmd'
8+
- 'HierarchicalEOM.jl/**/*.qmd'
9+
- 'Project.toml'
10+
- 'apt.txt'
11+
- 'postBuild'
12+
- '.jupyter/**'
13+
- '.github/workflows/build-notebooks.yml'
14+
- '.github/workflows/build-notebooks-container.yml'
15+
workflow_dispatch:
16+
17+
permissions:
18+
contents: write
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout main
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Setup Quarto
30+
uses: quarto-dev/quarto-actions/setup@v2
31+
32+
- name: Render QMD → IPYNB
33+
run: |
34+
set -euo pipefail
35+
shopt -s globstar nullglob
36+
for src in QuantumToolbox.jl/**/*.qmd; do
37+
quarto render "$src" --to ipynb
38+
done
39+
for src in HierarchicalEOM.jl/**/*.qmd; do
40+
quarto render "$src" --to ipynb
41+
done
42+
43+
- name: Checkout notebooks branch
44+
uses: actions/checkout@v4
45+
with:
46+
ref: notebooks
47+
path: branch-out
48+
fetch-depth: 0
49+
50+
# Prune stale files
51+
# This looks at every tracked *.ipynb, checks whether *.qmd still exists in main, and removes it from the index if not.
52+
- name: Remove stale notebooks
53+
run: |
54+
cd branch-out
55+
git ls-files "*.ipynb" | while read ipynb; do
56+
src="../${ipynb%.ipynb}.qmd"
57+
if [ ! -f "$src" ]; then
58+
git rm --ignore-unmatch "$ipynb"
59+
fi
60+
done
61+
cd ..
62+
63+
- name: Copy artifacts
64+
run: |
65+
# helper files at root
66+
cp Project.toml runtime.txt apt.txt postBuild branch-out/ 2>/dev/null || true
67+
cp -r .jupyter branch-out/ 2>/dev/null || true
68+
69+
rsync -avc --exclude='branch-out/' --include='*/' --include='*.ipynb' --exclude='*' --prune-empty-dirs ./ branch-out/
70+
71+
- name: Commit & Push
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
run: |
75+
cd branch-out
76+
git config user.name "github-actions"
77+
git config user.email "[email protected]"
78+
git add .
79+
if git diff --cached --quiet; then
80+
echo "✅ No changes to push"
81+
else
82+
git commit -m "Update notebooks from ${{ github.sha }}"
83+
git push origin notebooks
84+
fi

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ pyenv/
2828
/_site/
2929
/_output/
3030
*.html
31-
*.svg
3231
*.gif
3332
*.json
3433
/site_libs/
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Traitlet configuration file for jupyter-notebook.
2+
3+
c.ServerProxy.servers = {
4+
'vscode': {
5+
'command': ['code-server', '--auth', 'none', '--disable-telemetry', '--port={port}', '.'],
6+
'timeout': 300,
7+
'launcher_entry': {
8+
'enabled': True,
9+
'icon_path': '.jupyter/vscode.svg',
10+
'title': 'VS Code',
11+
},
12+
},
13+
}

.jupyter/vscode.svg

Lines changed: 21 additions & 0 deletions
Loading

HierarchicalEOM.jl/SIAM.qmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
title: "Single-impurity Anderson model"
33
author: Yi-Te Huang
44
date: last-modified
5+
6+
other-links:
7+
- text: Run notebook in Binder
8+
href: "https://mybinder.org/v2/gh/qutip/qutip-julia-tutorials/notebooks/?urlpath=lab/tree/HierarchicalEOM.jl/SIAM.ipynb"
9+
icon: file-code
510
---
611

712
## Introduction

HierarchicalEOM.jl/cavityQED.qmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
title: "Cavity QED system"
33
author: Shen-Liang Yang, Yi-Te Huang
44
date: last-modified
5+
6+
other-links:
7+
- text: Run notebook in Binder
8+
href: "https://mybinder.org/v2/gh/qutip/qutip-julia-tutorials/notebooks/?urlpath=lab/tree/HierarchicalEOM.jl/cavityQED.ipynb"
9+
icon: file-code
510
---
611

712
## Introduction

HierarchicalEOM.jl/dynamical_decoupling.qmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
title: "Driven systems and dynamical decoupling"
33
author: Yi-Te Huang
44
date: last-modified
5+
6+
other-links:
7+
- text: Run notebook in Binder
8+
href: "https://mybinder.org/v2/gh/qutip/qutip-julia-tutorials/notebooks/?urlpath=lab/tree/HierarchicalEOM.jl/dynamical_decoupling.ipynb"
9+
icon: file-code
510
---
611

712
Inspirations taken from an example in QuTiP-BoFiN article [@QuTiP-BoFiN2023].

HierarchicalEOM.jl/electronic_current.qmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
title: "Electronic Current"
33
author: Yi-Te Huang
44
date: last-modified
5+
6+
other-links:
7+
- text: Run notebook in Binder
8+
href: "https://mybinder.org/v2/gh/qutip/qutip-julia-tutorials/notebooks/?urlpath=lab/tree/HierarchicalEOM.jl/electronic_current.ipynb"
9+
icon: file-code
510
---
611

712
Inspirations taken from [qutip documentation](https://qutip.org/documentation.html).

Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
33
HierarchicalEOM = "a62dbcb7-80f5-4d31-9a88-8b19fd92b128"
44
QuantumToolbox = "6c2fb7c5-b903-41d2-bc5e-5a7c320b9fab"
5+
QuartoNotebookRunner = "4c0109c6-14e9-4c88-93f0-2b974d3468f4"

0 commit comments

Comments
 (0)