Skip to content

Commit 0ef1be6

Browse files
committed
Merge branch 'main' into feature/generate-notebook-index
2 parents 45e77bf + 5e563a2 commit 0ef1be6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2363
-133
lines changed

.github/workflows/nightly_ci.yaml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,28 @@ jobs:
2020
- qutip-version: '5'
2121
qutip-branch: 'master'
2222
steps:
23-
- uses: actions/checkout@v3
23+
- uses: actions/checkout@v4
2424
- uses: gaurav-nelson/github-action-markdown-link-check@v1
2525
with:
2626
use-quiet-mode: 'yes'
2727
folder-path: tutorials-v${{ matrix.qutip-version }}
28+
#use config file to define 403 and 405 errors as valid links
29+
#(APS blocks this link check)
30+
config-file: mlc_config.json
2831

29-
- name: Setup Mambaforge
30-
uses: conda-incubator/setup-miniconda@v2
32+
- name: Setup Conda
33+
uses: conda-incubator/setup-miniconda@v3
3134
with:
32-
miniforge-variant: Mambaforge
3335
miniforge-version: latest
34-
activate-environment: test-environment
35-
use-mamba: true
36+
activate-environment: test-environment-v${{ matrix.qutip-version }}
3637

3738
- name: Get Date
3839
id: get-date
3940
run: echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')"
4041
shell: bash
4142

4243
- name: Cache Conda env
43-
uses: actions/cache@v2
44+
uses: actions/cache@v3
4445
with:
4546
path: ${{ env.CONDA }}/envs
4647
key: conda-${{ runner.os }}--${{ runner.arch }}--${{ steps.get-date.outputs.today }}-${{ hashFiles('test_environment.yml') }}-${{ env.CACHE_NUMBER }}-qutip-${{ matrix.qutip-version }}
@@ -51,7 +52,7 @@ jobs:
5152

5253
- name: Install environment
5354
if: steps.cache.outputs.cache-hit != 'true'
54-
run: mamba env update -n test-environment -f test_environment.yml
55+
run: conda env update -n test-environment-v${{ matrix.qutip-version }} -f test_environment-v${{ matrix.qutip-version }}.yml
5556

5657
- name: Install QuTiP
5758
run: |
@@ -104,3 +105,20 @@ jobs:
104105
path: |
105106
notebooks/*.ipynb
106107
notebooks/**/*.ipynb
108+
109+
110+
finalise:
111+
needs: pytests
112+
if: failure()
113+
runs-on: ubuntu-latest
114+
steps:
115+
- uses: actions/checkout@v4
116+
- name: Open Issue on Failure
117+
env:
118+
GITHUB_TOKEN: ${{ github.token }}
119+
run: |
120+
if [[ -z "${{ inputs.open_issue }}" ]] || [[ "${{ inputs.open_issue }}" != "False" ]];
121+
then
122+
pip install requests
123+
python tools/report_failing_tests.py $GITHUB_TOKEN
124+
fi

.github/workflows/notebook_ci.yaml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,29 @@ jobs:
2121
- qutip-version: '5'
2222
qutip-branch: 'master'
2323
steps:
24-
- uses: actions/checkout@v3
24+
- uses: actions/checkout@v4
2525

2626
- uses: gaurav-nelson/github-action-markdown-link-check@v1
2727
with:
2828
use-quiet-mode: 'yes'
2929
folder-path: tutorials-v${{ matrix.qutip-version }}
30+
#use config file to define 403 and 405 errors as valid links
31+
#(APS blocks this link check)
32+
config-file: mlc_config.json
3033

31-
- name: Setup Mambaforge
32-
uses: conda-incubator/setup-miniconda@v2
34+
- name: Setup Conda
35+
uses: conda-incubator/setup-miniconda@v3
3336
with:
34-
miniforge-variant: Mambaforge
3537
miniforge-version: latest
36-
activate-environment: test-environment
37-
use-mamba: true
38+
activate-environment: test-environment-v${{ matrix.qutip-version }}
3839

3940
- name: Get Date
4041
id: get-date
4142
run: echo "::set-output name=today::$(/bin/date -u '+%Y%m%d')"
4243
shell: bash
4344

4445
- name: Cache Conda env
45-
uses: actions/cache@v2
46+
uses: actions/cache@v3
4647
with:
4748
path: ${{ env.CONDA }}/envs
4849
key: conda-${{ runner.os }}--${{ runner.arch }}--${{ steps.get-date.outputs.today }}-${{ hashFiles('test_environment.yml') }}-${{ env.CACHE_NUMBER }}-qutip-${{ matrix.qutip-version }}
@@ -53,7 +54,7 @@ jobs:
5354

5455
- name: Install environment
5556
if: steps.cache.outputs.cache-hit != 'true'
56-
run: mamba env update -n test-environment -f test_environment.yml
57+
run: conda env update -n test-environment-v${{ matrix.qutip-version }} -f test_environment-v${{ matrix.qutip-version }}.yml
5758

5859
- name: Install QuTiP
5960
run: |
@@ -111,7 +112,7 @@ jobs:
111112
runs-on: ubuntu-latest
112113
if: ${{ github.repository == 'qutip/qutip-tutorials' && github.ref == 'refs/heads/main' }}
113114
steps:
114-
- uses: actions/checkout@v3
115+
- uses: actions/checkout@v4
115116
- uses: actions/download-artifact@v4
116117
with:
117118
name: executed-notebooks-v4

mlc_config.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"projectBaseUrl":"${workspaceFolder}",
3+
"timeout": "20s",
4+
"retryOn429": true,
5+
"retryCount": 5,
6+
"fallbackRetryDelay": "30s",
7+
"aliveStatusCodes": [200, 206, 403, 405]
8+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: test-environment
1+
name: test-environment-v4
22
channels:
33
- conda-forge
44
dependencies:

test_environment-v5.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: test-environment-v5
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
- python==3.12
6+
- pip>=22.1.2
7+
- numpy>=2.0.0
8+
- scipy>=1.9
9+
- matplotlib>=3.9
10+
- imagemagick>=7.1.0_36
11+
- mpmath>=1.2.1
12+
- pytest>=7.1.2
13+
- nbmake>=1.3.4
14+
- jupytext>=1.13.8
15+
- jupyter>=1.0.0
16+
- ipykernel>=6.17.1 # 6.18.0 was yanked but is still present on conda-forge

tools/report_failing_tests.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
2+
import requests
3+
import json
4+
import sys
5+
import argparse
6+
from datetime import date
7+
8+
def open_issue(token):
9+
url = "https://api.github.com/repos/qutip/qutip-jax/issues"
10+
data = json.dumps({
11+
"title": f"Automated tests failed on {date.today()}",
12+
"labels": ["bug"],
13+
"body": "Scheduled test failed!"
14+
})
15+
16+
headers = {
17+
"Accept": "application/vnd.github.v3+json",
18+
"Authorization" : f"token {token}",
19+
}
20+
21+
post_request = requests.post(url=url, data=data, headers=headers)
22+
23+
if post_request.status_code == 201:
24+
print("Success")
25+
26+
else:
27+
print(
28+
"Fail:",
29+
post_request.status_code,
30+
post_request.reason,
31+
post_request.content
32+
)
33+
34+
35+
def main():
36+
parser = argparse.ArgumentParser(
37+
description="""Open an issue on failed tests."""
38+
)
39+
parser.add_argument("token")
40+
args = parser.parse_args()
41+
print(args.token)
42+
open_issue(args.token)
43+
44+
45+
if __name__ == "__main__":
46+
sys.exit(main())

tutorials-v4/lectures/Lecture-11-Charge-Qubits.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ where $E_C$ is the charge energy, $E_J$ is the Josephson energy, and $\left| n\r
3939

4040
#### References
4141

42-
* [J. Koch et al, Phys. Rec. A 76, 042319 (2007)](http://link.aps.org/doi/10.1103/PhysRevA.76.042319)
42+
* [J. Koch et al, Phys. Rec. A 76, 042319 (2007)](https://journals.aps.org/pra/abstract/10.1103/PhysRevA.76.042319)
4343
* [Y.A. Pashkin et al, Quantum Inf Process 8, 55 (2009)](http://dx.doi.org/10.1007/s11128-009-0101-5)
4444

4545

tutorials-v4/lectures/Lecture-2B-Single-Atom-Lasing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ in units where $\hbar = 1$.
6363

6464
References:
6565

66-
* [Yi Mu, C.M. Savage, Phys. Rev. A 46, 5944 (1992)](http://dx.doi.org/10.1103/PhysRevA.46.5944)
66+
* [Yi Mu, C.M. Savage, Phys. Rev. A 46, 5944 (1992)](https://journals.aps.org/pra/abstract/10.1103/PhysRevA.46.5944)
6767

68-
* [D.A. Rodrigues, J. Imbers, A.D. Armour, Phys. Rev. Lett. 98, 067204 (2007)](http://dx.doi.org/10.1103/PhysRevLett.98.067204)
68+
* [D.A. Rodrigues, J. Imbers, A.D. Armour, Phys. Rev. Lett. 98, 067204 (2007)](https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.98.067204)
6969

7070
* [S. Ashhab, J.R. Johansson, A.M. Zagoskin, F. Nori, New J. Phys. 11, 023030 (2009)](http://dx.doi.org/10.1088/1367-2630/11/2/023030)
7171

tutorials-v4/lectures/Lecture-3A-Dicke-model.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ $\displaystyle J_\pm = \sum_{i=1}^N \sigma_\pm^{(i)}$
4949

5050
### References
5151

52-
* [R.H. Dicke, Phys. Rev. 93, 99–110 (1954)](http://dx.doi.org/10.1103/PhysRev.93.99)
52+
* [R.H. Dicke, Phys. Rev. 93, 99–110 (1954)](https://journals.aps.org/pr/abstract/10.1103/PhysRev.93.99)
5353

5454

5555
## Setup problem in QuTiP
@@ -198,7 +198,7 @@ fig.tight_layout()
198198

199199
### References
200200

201-
* [Lambert et al., Phys. Rev. Lett. 92, 073602 (2004)](http://dx.doi.org/10.1103/PhysRevLett.92.073602).
201+
* [Lambert et al., Phys. Rev. Lett. 92, 073602 (2004)](https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.92.073602).
202202

203203
```python
204204
def calulcate_entropy(M, N, g_vec):

tutorials-v4/lectures/Lecture-3B-Jaynes-Cumming-model-with-ultrastrong-coupling.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ The regime $g$ is large compared with all other energy scales in the Hamiltonian
5151

5252
References:
5353

54-
* [P. Nataf et al., Phys. Rev. Lett. 104, 023601 (2010)](http://dx.doi.org/10.1103/PhysRevLett.104.023601)
54+
* [P. Nataf et al., Phys. Rev. Lett. 104, 023601 (2010)](https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.104.023601)
5555

56-
* [J. Casanova et al., Phys. Rev. Lett. 105, 26360 (2010)](http://dx.doi.org/10.1103/PhysRevLett.105.263603).
56+
* [J. Casanova et al., Phys. Rev. Lett. 105, 26360 (2010)](https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.105.263603).
5757

58-
* [S. Ashhab et al., Phys. Rev. A 81, 042311 (2010)](http://dx.doi.org/10.1103/PhysRevA.81.042311)
58+
* [S. Ashhab et al., Phys. Rev. A 81, 042311 (2010)](https://journals.aps.org/pra/abstract/10.1103/PhysRevA.81.042311)
5959
<!-- #endregion -->
6060

6161
<!-- #region -->

0 commit comments

Comments
 (0)