Skip to content

Commit 1b7c680

Browse files
authored
Merge branch 'main' into copilot/fix-407
2 parents 8d96b65 + 11122d7 commit 1b7c680

25 files changed

Lines changed: 703 additions & 17205 deletions

.github/workflows/cache.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ on:
66
workflow_dispatch:
77
jobs:
88
cache:
9-
runs-on: "runs-on=${{ github.run_id }}/family=g4dn.2xlarge/image=quantecon_ubuntu2404/disk=large"
9+
runs-on: "runs-on=${{ github.run_id }}/family=g4dn.2xlarge/image=quantecon_ubuntu2404/volume=80gb/spot=false"
1010
steps:
11-
- uses: actions/checkout@v6
11+
- uses: actions/checkout@v7
1212
- name: Setup Anaconda
13-
uses: conda-incubator/setup-miniconda@v3
13+
uses: conda-incubator/setup-miniconda@v4
1414
with:
1515
auto-update-conda: true
1616
auto-activate-base: true

.github/workflows/ci.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ name: Build Project [using jupyter-book]
22
on: [pull_request]
33
jobs:
44
preview:
5-
runs-on: "runs-on=${{ github.run_id }}/family=g4dn.2xlarge/image=quantecon_ubuntu2404/disk=large"
5+
runs-on: "runs-on=${{ github.run_id }}/family=g4dn.2xlarge/image=quantecon_ubuntu2404/volume=80gb/spot=false"
66
steps:
7-
- uses: actions/checkout@v6
7+
- uses: actions/checkout@v7
88
with:
99
fetch-depth: 0 # Fetch full git history for changelog feature
1010
- name: Setup Anaconda
11-
uses: conda-incubator/setup-miniconda@v3
11+
uses: conda-incubator/setup-miniconda@v4
1212
with:
1313
auto-update-conda: true
1414
auto-activate-base: true
@@ -45,7 +45,7 @@ jobs:
4545
shell: bash -l {0}
4646
run: pip list
4747
- name: Download "build" folder (cache)
48-
uses: dawidd6/action-download-artifact@v20
48+
uses: dawidd6/action-download-artifact@v21
4949
with:
5050
workflow: cache.yml
5151
branch: main
@@ -55,6 +55,18 @@ jobs:
5555
- name: Build Download Notebooks (sphinx-tojupyter)
5656
shell: bash -l {0}
5757
run: |
58+
# This is the FIRST `jb build` in the workflow, and `execute_notebooks: "cache"`
59+
# means only the first build actually executes notebooks — the later HTML build
60+
# reads the cache. So this is the step where a CellExecutionError surfaces, and
61+
# therefore the step that has to gate.
62+
#
63+
# `set -eo pipefail` is required as well as `-W`: `shell: bash -l {0}` is a
64+
# custom shell spec, so GitHub does not inject `-eo pipefail` (it only does
65+
# that for the bare `shell: bash` shorthand). Without it a failing `jb build`
66+
# would be masked by the trailing mkdir/cp, whose exit code becomes the
67+
# step's — and `--keep-going` guarantees the .ipynb files exist for `cp`
68+
# to succeed on.
69+
set -eo pipefail
5870
jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter -n -W --keep-going
5971
mkdir -p _build/html/_notebooks
6072
cp -u _build/jupyter/*.ipynb _build/html/_notebooks
@@ -76,7 +88,7 @@ jobs:
7688
name: execution-reports
7789
path: _build/html/reports
7890
- name: Preview Deploy to Netlify
79-
uses: nwtgck/actions-netlify@v3
91+
uses: nwtgck/actions-netlify@v4
8092
with:
8193
publish-dir: '_build/html/'
8294
production-branch: main

.github/workflows/execution-linux.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ jobs:
1414
python-version: ["3.13"]
1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v6
18-
- uses: conda-incubator/setup-miniconda@v3
17+
uses: actions/checkout@v7
18+
- uses: conda-incubator/setup-miniconda@v4
1919
with:
2020
auto-update-conda: true
2121
python-version: ${{ matrix.python-version }}

.github/workflows/execution-osx.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ jobs:
1414
python-version: ["3.13"]
1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v6
18-
- uses: conda-incubator/setup-miniconda@v3
17+
uses: actions/checkout@v7
18+
- uses: conda-incubator/setup-miniconda@v4
1919
with:
2020
auto-update-conda: true
2121
python-version: ${{ matrix.python-version }}

.github/workflows/execution-win.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ jobs:
1414
python-version: ["3.13"]
1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v6
18-
- uses: conda-incubator/setup-miniconda@v3
17+
uses: actions/checkout@v7
18+
- uses: conda-incubator/setup-miniconda@v4
1919
with:
2020
auto-update-conda: true
2121
python-version: ${{ matrix.python-version }}

.github/workflows/publish.yml

Lines changed: 13 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ concurrency:
1717
jobs:
1818
publish:
1919
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
20-
runs-on: "runs-on=${{ github.run_id }}/family=g4dn.2xlarge/image=quantecon_ubuntu2404/disk=large"
20+
runs-on: "runs-on=${{ github.run_id }}/family=g4dn.2xlarge/image=quantecon_ubuntu2404/volume=80gb"
2121
environment:
2222
name: github-pages
23-
url: ${{ steps.deployment.outputs.page_url }}
23+
url: ${{ steps.deployment.outputs['page-url'] }}
2424
steps:
2525
- name: Checkout
26-
uses: actions/checkout@v6
26+
uses: actions/checkout@v7
2727
with:
2828
fetch-depth: 0 # Fetch full git history for changelog feature
2929
- name: Setup Anaconda
30-
uses: conda-incubator/setup-miniconda@v3
30+
uses: conda-incubator/setup-miniconda@v4
3131
with:
3232
auto-update-conda: true
3333
auto-activate-base: true
@@ -66,7 +66,7 @@ jobs:
6666
run: pip list
6767
# Download Build Cache from cache.yml
6868
- name: Download "build" folder (cache)
69-
uses: dawidd6/action-download-artifact@v20
69+
uses: dawidd6/action-download-artifact@v21
7070
with:
7171
workflow: cache.yml
7272
branch: main
@@ -101,43 +101,16 @@ jobs:
101101
shell: bash -l {0}
102102
run: |
103103
jb build lectures --path-output ./ -n -W --keep-going
104-
# Create HTML archive for release assets
105-
- name: Create HTML archive
106-
shell: bash -l {0}
107-
run: |
108-
tar -czf lecture-python-programming-html-${{ github.ref_name }}.tar.gz -C _build/html .
109-
sha256sum lecture-python-programming-html-${{ github.ref_name }}.tar.gz > html-checksum.txt
110-
111-
# Create metadata manifest
112-
cat > html-manifest.json << EOF
113-
{
114-
"tag": "${{ github.ref_name }}",
115-
"commit": "${{ github.sha }}",
116-
"timestamp": "$(date -Iseconds)",
117-
"size_mb": $(du -sm _build/html | cut -f1),
118-
"file_count": $(find _build/html -type f | wc -l)
119-
}
120-
EOF
121-
- name: Upload archives to release
122-
uses: softprops/action-gh-release@v2
123-
with:
124-
files: |
125-
lecture-python-programming-html-${{ github.ref_name }}.tar.gz
126-
html-checksum.txt
127-
html-manifest.json
128-
env:
129-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130-
- name: Add CNAME for custom domain
131-
run: echo "python-programming.quantecon.org" > _build/html/CNAME
132-
- name: Setup Pages
133-
uses: actions/configure-pages@v6
134-
- name: Upload Pages artifact
135-
uses: actions/upload-pages-artifact@v4
136-
with:
137-
path: _build/html/
104+
# Deploy to GitHub Pages + publish release assets (html archive, checksum, manifest)
138105
- name: Deploy to GitHub Pages
139106
id: deployment
140-
uses: actions/deploy-pages@v5
107+
uses: quantecon/actions/publish-gh-pages@v0.9.0
108+
with:
109+
build-dir: _build/html
110+
cname: python-programming.quantecon.org
111+
create-release-assets: 'true'
112+
asset-name: 'lecture-python-programming-html'
113+
github-token: ${{ secrets.GITHUB_TOKEN }}
141114
- name: Prepare lecture-python-programming.notebooks sync
142115
shell: bash -l {0}
143116
run: |

.github/workflows/sync-translations-fa.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,28 @@ on:
1414

1515
jobs:
1616
sync:
17+
# The issue_comment path requires all three: a comment on a PR (not a bare
18+
# issue), the command, and a trusted author — otherwise any account could
19+
# fire a secrets-bearing run (Anthropic spend plus the PAT) from any comment.
1720
if: >
1821
(github.event_name == 'pull_request' && github.event.pull_request.merged == true) ||
19-
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '\translate-resync'))
22+
(github.event_name == 'issue_comment' &&
23+
github.event.issue.pull_request &&
24+
contains(github.event.comment.body, '\translate-resync') &&
25+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association))
2026
runs-on: ubuntu-latest
2127

28+
# The action authenticates with QUANTECON_SERVICES_PAT; the ambient
29+
# GITHUB_TOKEN is unused beyond checkout, so keep it read-only.
30+
permissions:
31+
contents: read
32+
2233
steps:
23-
- uses: actions/checkout@v6
34+
- uses: actions/checkout@v7
2435
with:
2536
fetch-depth: 2
2637

27-
- uses: QuantEcon/action-translation@v0.14.1
38+
- uses: QuantEcon/action-translation@v0
2839
with:
2940
mode: sync
3041
target-repo: QuantEcon/lecture-python-programming.fa
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Sync Translations — French
2+
# On merged PR, translate changed lectures into the French target repo.
3+
# Comment \translate-resync on a merged PR to re-trigger sync.
4+
name: Sync Translations (French)
5+
6+
on:
7+
pull_request:
8+
types: [closed]
9+
paths:
10+
- 'lectures/**/*.md'
11+
- 'lectures/_toc.yml'
12+
issue_comment:
13+
types: [created]
14+
15+
jobs:
16+
sync:
17+
# The issue_comment path requires all three: a comment on a PR (not a bare
18+
# issue), the command, and a trusted author — otherwise any account could
19+
# fire a secrets-bearing run (Anthropic spend plus the PAT) from any comment.
20+
if: >
21+
(github.event_name == 'pull_request' && github.event.pull_request.merged == true) ||
22+
(github.event_name == 'issue_comment' &&
23+
github.event.issue.pull_request &&
24+
contains(github.event.comment.body, '\translate-resync') &&
25+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association))
26+
runs-on: ubuntu-latest
27+
28+
# The action authenticates with QUANTECON_SERVICES_PAT; the ambient
29+
# GITHUB_TOKEN is unused beyond checkout, so keep it read-only.
30+
permissions:
31+
contents: read
32+
33+
steps:
34+
- uses: actions/checkout@v7
35+
with:
36+
fetch-depth: 2
37+
38+
- uses: QuantEcon/action-translation@v0
39+
with:
40+
mode: sync
41+
target-repo: QuantEcon/lecture-python-programming.fr
42+
target-language: fr
43+
source-language: en
44+
docs-folder: lectures
45+
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
46+
github-token: ${{ secrets.QUANTECON_SERVICES_PAT }}

.github/workflows/sync-translations-zh-cn.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,28 @@ on:
1414

1515
jobs:
1616
sync:
17+
# The issue_comment path requires all three: a comment on a PR (not a bare
18+
# issue), the command, and a trusted author — otherwise any account could
19+
# fire a secrets-bearing run (Anthropic spend plus the PAT) from any comment.
1720
if: >
1821
(github.event_name == 'pull_request' && github.event.pull_request.merged == true) ||
19-
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '\translate-resync'))
22+
(github.event_name == 'issue_comment' &&
23+
github.event.issue.pull_request &&
24+
contains(github.event.comment.body, '\translate-resync') &&
25+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association))
2026
runs-on: ubuntu-latest
2127

28+
# The action authenticates with QUANTECON_SERVICES_PAT; the ambient
29+
# GITHUB_TOKEN is unused beyond checkout, so keep it read-only.
30+
permissions:
31+
contents: read
32+
2233
steps:
23-
- uses: actions/checkout@v6
34+
- uses: actions/checkout@v7
2435
with:
2536
fetch-depth: 2
2637

27-
- uses: QuantEcon/action-translation@v0.14.1
38+
- uses: QuantEcon/action-translation@v0
2839
with:
2940
mode: sync
3041
target-repo: QuantEcon/lecture-python-programming.zh-cn

environment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ channels:
33
- default
44
dependencies:
55
- python=3.13
6-
- anaconda=2025.12
6+
- anaconda=2026.07
77
- pip
88
- pip:
99
- jupyter-book>=1.0.4post1,<2.0
10-
- quantecon-book-theme==0.20.0
10+
- quantecon-book-theme==0.21.0
1111
- sphinx-tojupyter==0.6.0
1212
- sphinxext-rediraffe==0.3.0
1313
- sphinx-exercise==1.2.1

0 commit comments

Comments
 (0)