From 75b6e196ba92549e8bc6c20e9c9b0c1395c39a24 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Mon, 22 Dec 2025 12:27:50 +1100 Subject: [PATCH 1/6] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Upgrade=20build=20soft?= =?UTF-8?q?ware=20and=20dependencies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Upgrade anaconda to 2025.12 - Upgrade quantecon-book-theme to 0.15.1 - Add jupyter-book version constraint (<2.0) - Configure Dependabot for conda ecosystem with jupyter-book restriction - Add nb_merge_streams and path_to_docs to _config.yml - Temporarily disable build cache for full execution check --- .github/dependabot.yml | 10 ++++++++++ .github/workflows/ci.yml | 14 +++++++------- environment.yml | 6 +++--- lectures/_config.yml | 2 ++ 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 7809c2a9..bb2ad36d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -11,3 +11,13 @@ updates: prefix: ⬆️ schedule: interval: weekly + + - package-ecosystem: "conda" + directory: "/" + commit-message: + prefix: ⬆️ + schedule: + interval: weekly + ignore: + - dependency-name: "jupyter-book" + versions: [">=2.0"] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f9c8d1ad..4431941f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,13 +36,13 @@ jobs: - name: Display Pip Versions shell: bash -l {0} run: pip list - - name: Download "build" folder (cache) - uses: dawidd6/action-download-artifact@v11 - with: - workflow: cache.yml - branch: main - name: build-cache - path: _build + # - name: Download "build" folder (cache) + # uses: dawidd6/action-download-artifact@v11 + # with: + # workflow: cache.yml + # branch: main + # name: build-cache + # path: _build # Build Assets (Download Notebooks and PDF via LaTeX) - name: Build PDF from LaTeX shell: bash -l {0} diff --git a/environment.yml b/environment.yml index e55f9368..c22c3954 100644 --- a/environment.yml +++ b/environment.yml @@ -3,11 +3,11 @@ channels: - default dependencies: - python=3.13 - - anaconda=2025.06 + - anaconda=2025.12 - pip - pip: - - jupyter-book==1.0.4post1 - - quantecon-book-theme==0.9.3 + - jupyter-book>=1.0.4post1,<2.0 + - quantecon-book-theme==0.15.1 - sphinx-tojupyter==0.3.1 - sphinxext-rediraffe==0.2.7 - sphinx-exercise==1.0.1 diff --git a/lectures/_config.yml b/lectures/_config.yml index be53925a..cb5e87d1 100644 --- a/lectures/_config.yml +++ b/lectures/_config.yml @@ -39,6 +39,7 @@ sphinx: 'https://doi.org/10.1086/262078', 'https://keras.io/', 'https://data.oecd.org/'] + nb_merge_streams: true nb_mime_priority_overrides: [ # HTML ['html', 'application/vnd.jupyter.widget-view+json', 10], @@ -85,6 +86,7 @@ sphinx: header_organisation: QuantEcon repository_url: https://github.com/QuantEcon/lecture-python-advanced.myst nb_repository_url: https://github.com/QuantEcon/lecture-python-advanced.notebooks + path_to_docs: lectures twitter: quantecon twitter_logo_url: https://assets.quantecon.org/img/qe-twitter-logo.png og_logo_url: https://assets.quantecon.org/img/qe-og-logo.png From 940f6763b70cf6b877efc028dd89985412dfa7fc Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Mon, 22 Dec 2025 16:18:56 +1100 Subject: [PATCH 2/6] Fix plotly orca timeout errors by using kaleido engine - Add kaleido to environment.yml for reliable image export - Update all fig.to_image() calls to use engine='kaleido' - Fixes execution errors in BCG_complete_mkts, BCG_incomplete_mkts, and knowing_forecasts_of_others - Kaleido is the modern replacement for orca and works reliably in CI environments --- environment.yml | 1 + lectures/BCG_complete_mkts.md | 2 +- lectures/BCG_incomplete_mkts.md | 10 +++++----- lectures/knowing_forecasts_of_others.md | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/environment.yml b/environment.yml index c22c3954..f025c913 100644 --- a/environment.yml +++ b/environment.yml @@ -15,5 +15,6 @@ dependencies: - sphinxcontrib-youtube==1.4.1 - sphinx-togglebutton==0.3.2 - sphinx-reredirects==0.1.4 + - kaleido diff --git a/lectures/BCG_complete_mkts.md b/lectures/BCG_complete_mkts.md index f5a44c3a..03163c21 100644 --- a/lectures/BCG_complete_mkts.md +++ b/lectures/BCG_complete_mkts.md @@ -1194,7 +1194,7 @@ fig.update_layout(width=500, fig.update_layout(scene_camera=dict(eye=dict(x=2, y=-2, z=1.5))) # Export to PNG file -Image(fig.to_image(format="png")) +Image(fig.to_image(format="png", engine="kaleido")) # fig.show() will provide interactive plot when running # notebook locally ``` diff --git a/lectures/BCG_incomplete_mkts.md b/lectures/BCG_incomplete_mkts.md index 7c2445c1..c6a282bb 100644 --- a/lectures/BCG_incomplete_mkts.md +++ b/lectures/BCG_incomplete_mkts.md @@ -1270,7 +1270,7 @@ fig.update_layout(scene_camera=dict(eye=dict(x=1.5, y=-1.5, z=2))) fig.update_layout(title='Equilibrium firm valuation for the grid of (k,b)') # Export to PNG file -Image(fig.to_image(format="png")) +Image(fig.to_image(format="png", engine="kaleido")) # fig.show() will provide interactive plot when running # code locally ``` @@ -1634,7 +1634,7 @@ fig.update_layout(title='Equilibrium firm valuation for the grid of (k,b)') # Export to PNG file -Image(fig.to_image(format="png")) +Image(fig.to_image(format="png", engine="kaleido")) # fig.show() will provide interactive plot when running # code locally ``` @@ -1685,7 +1685,7 @@ fig.update_layout(scene_camera=dict(eye=dict(x=1.5, y=-1.5, z=2))) fig.update_layout(title='Equilibrium firm valuation for the grid of (k,b)') # Export to PNG file -Image(fig.to_image(format="png")) +Image(fig.to_image(format="png", engine="kaleido")) # fig.show() will provide interactive plot when running # code locally ``` @@ -1746,7 +1746,7 @@ fig.update_layout(title='Equilibrium equity valuation for the grid of (k,b)') # Export to PNG file -Image(fig.to_image(format="png")) +Image(fig.to_image(format="png", engine="kaleido")) # fig.show() will provide interactive plot when running # code locally ``` @@ -1776,7 +1776,7 @@ fig.update_layout(title='Equilibrium bond valuation for the grid of (k,b)') # Export to PNG file -Image(fig.to_image(format="png")) +Image(fig.to_image(format="png", engine="kaleido")) # fig.show() will provide interactive plot when running # code locally ``` diff --git a/lectures/knowing_forecasts_of_others.md b/lectures/knowing_forecasts_of_others.md index da6d1909..ae198ed9 100644 --- a/lectures/knowing_forecasts_of_others.md +++ b/lectures/knowing_forecasts_of_others.md @@ -1020,7 +1020,7 @@ fig.update_layout(title=r'Impulse Response Function', yaxis_title=r'$k^{i}_{t}$') fig1 = fig # Export to PNG file -Image(fig1.to_image(format="png")) +Image(fig1.to_image(format="png", engine="kaleido")) # fig1.show() will provide interactive plot when running # notebook locally ``` From eb0d904c2d6ec7dc4bcf043e4a200f12ee4ab9b0 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Tue, 23 Dec 2025 12:41:15 +1100 Subject: [PATCH 3/6] Fix scipy gradient compatibility for Python 3.13 - Update objf_prime to return 1D gradient array instead of 2D - Fixes 'Input array gradx must be 1D' error in amss2 and amss3 - Resolves compatibility issue with scipy.optimize.fmin_slsqp in Python 3.13 --- .../lecture_specific/amss2/recursive_allocation.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lectures/_static/lecture_specific/amss2/recursive_allocation.py b/lectures/_static/lecture_specific/amss2/recursive_allocation.py index 3dd83501..f91f20c7 100644 --- a/lectures/_static/lecture_specific/amss2/recursive_allocation.py +++ b/lectures/_static/lecture_specific/amss2/recursive_allocation.py @@ -231,15 +231,15 @@ def objf_prime(x): epsilon = 1e-7 x0 = np.asarray(x, dtype=float) - f0 = np.atleast_1d(objf(x0)) - jac = np.zeros([len(x0), len(f0)]) + f0 = objf(x0) + grad = np.zeros(len(x0)) dx = np.zeros(len(x0)) for i in range(len(x0)): dx[i] = epsilon - jac[i] = (objf(x0+dx) - f0)/epsilon + grad[i] = (objf(x0+dx) - f0)/epsilon dx[i] = 0.0 - return jac.transpose() + return grad def cons(z): c, n, xprime, T = z[:S], z[S:2 * S], z[2 * S:3 * S], z[3 * S:] From 9cfd65904efe0f1b224e13d4db600435b3c2f42c Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Tue, 23 Dec 2025 13:03:40 +1100 Subject: [PATCH 4/6] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Configure=20dependabot?= =?UTF-8?q?=20to=20ignore=20Python=20version=20updates?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Python version should be constrained by the anaconda distribution version specified in environment.yml, not updated independently by dependabot. --- .github/dependabot.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index bb2ad36d..1ab7ca35 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -21,3 +21,5 @@ updates: ignore: - dependency-name: "jupyter-book" versions: [">=2.0"] + - dependency-name: "python" + # Python version should be constrained by the anaconda distribution version From 753124417b80a33b6a4ea8afbfec04fafd7448b8 Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Tue, 23 Dec 2025 14:06:09 +1100 Subject: [PATCH 5/6] Update .github/dependabot.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/dependabot.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 1ab7ca35..04804108 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -23,3 +23,4 @@ updates: versions: [">=2.0"] - dependency-name: "python" # Python version should be constrained by the anaconda distribution version + versions: [">0"] From e3cc859a27d75ef62211ecb4d2eca26ec5b5f6bc Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Tue, 23 Dec 2025 21:32:38 +1100 Subject: [PATCH 6/6] Re-enable build cache in CI workflow --- .github/workflows/ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4431941f..f9c8d1ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,13 +36,13 @@ jobs: - name: Display Pip Versions shell: bash -l {0} run: pip list - # - name: Download "build" folder (cache) - # uses: dawidd6/action-download-artifact@v11 - # with: - # workflow: cache.yml - # branch: main - # name: build-cache - # path: _build + - name: Download "build" folder (cache) + uses: dawidd6/action-download-artifact@v11 + with: + workflow: cache.yml + branch: main + name: build-cache + path: _build # Build Assets (Download Notebooks and PDF via LaTeX) - name: Build PDF from LaTeX shell: bash -l {0}