diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2136dd4..a21c6dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,6 +47,9 @@ jobs: branch: main name: build-cache path: _build + - name: Clear stale Sphinx environment + shell: bash -l {0} + run: rm -rf _build/.doctrees # # Build Assets (Download Notebooks and PDF via LaTeX) # - name: Build PDF from LaTeX # shell: bash -l {0} @@ -63,13 +66,22 @@ jobs: - name: Build Download Notebooks (sphinx-tojupyter) shell: bash -l {0} run: | - jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter + # `shell: bash -l {0}` is a custom shell spec, so GitHub does not inject + # `-eo pipefail` (it only does that for the bare `shell: bash` shorthand). + # Without this, a failing `jb build` would be masked by the trailing + # mkdir/cp, whose exit code becomes the step's — and `--keep-going` + # guarantees the .ipynb files exist for `cp` to succeed on. + set -eo pipefail + jb build lectures -n -W --keep-going --path-output ./ --builder=custom --custom-builder=jupyter mkdir -p _build/html/_notebooks cp -u _build/jupyter/*.ipynb _build/html/_notebooks + - name: Upload Execution Reports (Download Notebooks) + uses: actions/upload-artifact@v7 + if: failure() + with: + name: execution-reports-notebooks + path: _build/jupyter/reports # Build HTML (Website) - # BUG: rm .doctress to remove `sphinx` rendering issues for ipywidget mimetypes - # and clear the sphinx cache for building final HTML documents. - # rm -r _build/.doctrees - name: Build HTML shell: bash -l {0} run: | @@ -78,7 +90,7 @@ jobs: uses: actions/upload-artifact@v7 if: failure() with: - name: execution-reports + name: execution-reports-html path: _build/html/reports - name: Preview Deploy to Netlify uses: nwtgck/actions-netlify@v4.0 diff --git a/lectures/ak_aiyagari.md b/lectures/ak_aiyagari.md index 15dbf88..fc246e9 100644 --- a/lectures/ak_aiyagari.md +++ b/lectures/ak_aiyagari.md @@ -10,7 +10,7 @@ kernelspec: language: python name: python3 translation: - title: V, σ, μ + title: 长寿、异质性个体、世代交叠模型 headings: Overview: 概述 Environment: 经济环境 @@ -35,21 +35,6 @@ translation: 'Experiment 2: Preannounced tax cut': 实验2:预先宣布的减税 --- -``` ---- -jupytext: - text_representation: - extension: .md - format_name: myst - format_version: 0.13 - jupytext_version: 1.17.3 -kernelspec: - display_name: Python 3 (ipykernel) - language: python - name: python3 ---- - - # 长寿、异质性个体、世代交叠模型 ```{include} _admonition/gpu.md @@ -1477,4 +1462,3 @@ ax2.set_ylabel(r"j") plt.show() ``` -``` diff --git a/lectures/kalman_2.md b/lectures/kalman_2.md index ea01799..bdbf164 100644 --- a/lectures/kalman_2.md +++ b/lectures/kalman_2.md @@ -352,8 +352,8 @@ for i, t in enumerate(np.linspace(0, T-1, 3, dtype=int)): axs[i].set_ylabel(r'$u_{{{}}}$'.format(str(t))) cov_latex = ( - r'$\Sigma_{{{}}}= \begin{{bmatrix}} {:.2f} & {:.2f} \\ ' - r'{:.2f} & {:.2f} \end{{bmatrix}}$' + r'$\Sigma_{{{}}}= \left[ \substack{{{:.2f} \; {:.2f} \\ ' + r'{:.2f} \; {:.2f}}} \right]$' ).format(t, cov[0, 0], cov[0, 1], cov[1, 0], cov[1, 1]) axs[i].text(0.33, -0.15, cov_latex, transform=axs[i].transAxes) diff --git a/lectures/likelihood_bayes.md b/lectures/likelihood_bayes.md index 1400176..bcaffe5 100644 --- a/lectures/likelihood_bayes.md +++ b/lectures/likelihood_bayes.md @@ -62,10 +62,10 @@ translation: FONTPATH = "fonts/SourceHanSerifSC-SemiBold.otf" import matplotlib as mpl +import matplotlib.pyplot as plt mpl.font_manager.fontManager.addfont(FONTPATH) plt.rcParams['font.family'] = ['Source Han Serif SC'] -import matplotlib.pyplot as plt import numpy as np from numba import vectorize, jit, prange from math import gamma diff --git a/lectures/sir_model.md b/lectures/sir_model.md index 1f0daa7..6898ad8 100644 --- a/lectures/sir_model.md +++ b/lectures/sir_model.md @@ -21,7 +21,7 @@ translation: Ending Lockdown: 解除封锁 --- -```{raw} +```{raw} jupyter