Skip to content

Commit fe65200

Browse files
committed
Merge branch 'main' into sphinx-external-toc
2 parents ec62ff3 + c3d1f98 commit fe65200

File tree

9 files changed

+137
-20
lines changed

9 files changed

+137
-20
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ jobs:
1515
python-version: 3.8
1616
environment-file: environment.yml
1717
activate-environment: quantecon
18+
- name: Install latex dependencies
19+
run: |
20+
sudo apt-get -qq update
21+
sudo apt-get install -y \
22+
texlive-latex-recommended \
23+
texlive-latex-extra \
24+
texlive-fonts-recommended \
25+
texlive-fonts-extra \
26+
texlive-xetex \
27+
latexmk \
28+
xindy
1829
- name: Display Conda Environment Versions
1930
shell: bash -l {0}
2031
run: conda list
@@ -28,10 +39,24 @@ jobs:
2839
branch: main
2940
name: build-cache
3041
path: _build
42+
# Build Assets (Download Notebooks and PDF via LaTeX)
43+
- name: Build PDF from LaTeX
44+
shell: bash -l {0}
45+
run: |
46+
jb build lectures --builder pdflatex --path-output ./ -n --keep-going
47+
mkdir -p _build/html/_pdf
48+
cp -u _build/latex/*.pdf _build/html/_pdf
49+
- name: Build Download Notebooks (sphinx-tojupyter)
50+
shell: bash -l {0}
51+
run: |
52+
jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter
53+
mkdir -p _build/html/_notebooks
54+
cp -u _build/jupyter/*.ipynb _build/html/_notebooks
55+
# Build HTML (Website)
3156
- name: Build HTML
3257
shell: bash -l {0}
3358
run: |
34-
jb build lectures --path-output ./
59+
jb build -W --keep-going lectures --path-output ./
3560
- name: Save Build as Artifact
3661
uses: actions/upload-artifact@v1
3762
with:

.github/workflows/execution.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Run Execution Tests [Latest Anaconda]
2+
on:
3+
schedule:
4+
# UTC 22:00 is early morning in Australia
5+
- cron: '0 22 * * *'
6+
jobs:
7+
execution-tests-linux-osx:
8+
name: Execution Tests (${{ matrix.python-version }}, ${{ matrix.os }})
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
os: ["ubuntu-latest", "macos-latest"]
14+
python-version: ["3.8"]
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
- uses: conda-incubator/setup-miniconda@v2
19+
with:
20+
auto-update-conda: true
21+
python-version: ${{ matrix.python-version }}
22+
- name: Install Anaconda + Dependencies
23+
shell: bash -l {0}
24+
run: |
25+
conda install anaconda
26+
pip install jupyter-book sphinx-multitoc-numbering quantecon-book-theme sphinxext-rediraffe sphinx_tojupyter
27+
- name: Build Lectures (+ Execution Checks)
28+
shell: bash -l {0}
29+
run: jb build lectures --path-output=./ -W --keep-going
30+
- name: Upload Execution Reports
31+
uses: actions/upload-artifact@v2
32+
if: failure()
33+
with:
34+
name: execution-reports
35+
path: _build/html/reports
36+
# execution-tests-win:
37+
# name: Execution Tests (${{ matrix.python-version }}, ${{ matrix.os }})
38+
# runs-on: ${{ matrix.os }}
39+
# strategy:
40+
# fail-fast: false
41+
# matrix:
42+
# os: ["windows-latest"]
43+
# python-version: ["3.8"]
44+
# steps:
45+
# - name: Checkout
46+
# uses: actions/checkout@v2
47+
# - uses: conda-incubator/setup-miniconda@v2
48+
# with:
49+
# auto-update-conda: true
50+
# python-version: ${{ matrix.python-version }}
51+
# - name: Install Anaconda + Dependencies
52+
# shell: powershell
53+
# run: |
54+
# conda install anaconda
55+
# pip install jupyter-book
56+
# pip install jupyter-book sphinx-multitoc-numbering quantecon-book-theme sphinxext-rediraffe sphinx_tojupyter
57+
# - name: Build Lectures (+ Execution Checks)
58+
# shell: powershell
59+
# run: jb build lectures --path-output=./ -W --keep-going
60+
# - name: Upload Execution Reports
61+
# uses: actions/upload-artifact@v2
62+
# if: failure()
63+
# with:
64+
# name: execution-reports
65+
# path: _build/html/reports

.github/workflows/publish.yml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,33 @@ jobs:
1919
python-version: 3.8
2020
environment-file: environment.yml
2121
activate-environment: quantecon
22+
- name: Install latex dependencies
23+
run: |
24+
sudo apt-get -qq update
25+
sudo apt-get install -y \
26+
texlive-latex-recommended \
27+
texlive-latex-extra \
28+
texlive-fonts-recommended \
29+
texlive-fonts-extra \
30+
texlive-xetex \
31+
latexmk \
32+
xindy
2233
- name: Display Conda Environment Versions
2334
shell: bash -l {0}
2435
run: conda list
2536
- name: Display Pip Versions
2637
shell: bash -l {0}
2738
run: pip list
28-
- name: Build HTML
39+
# Build Assets (Download Notebooks and PDF via LaTeX)
40+
- name: Build PDF from LaTeX
2941
shell: bash -l {0}
3042
run: |
31-
jb build lectures --path-output ./
43+
jb build lectures --builder pdflatex --path-output ./ -n --keep-going
44+
- name: Copy LaTeX PDF for GH-PAGES
45+
shell: bash -l {0}
46+
run: |
47+
mkdir -p _build/html/_pdf
48+
cp -u _build/latex/*.pdf _build/html/_pdf
3249
- name: Build Download Notebooks (sphinx-tojupyter)
3350
shell: bash -l {0}
3451
run: |
@@ -41,8 +58,13 @@ jobs:
4158
- name: Copy Download Notebooks for GH-PAGES
4259
shell: bash -l {0}
4360
run: |
44-
mkdir _build/html/_notebooks
45-
cp _build/jupyter/*.ipynb _build/html/_notebooks
61+
mkdir -p _build/html/_notebooks
62+
cp -u _build/jupyter/*.ipynb _build/html/_notebooks
63+
# Build HTML (Website)
64+
- name: Build HTML
65+
shell: bash -l {0}
66+
run: |
67+
jb build lectures --path-output ./
4668
- name: Deploy website to gh-pages
4769
uses: peaceiris/actions-gh-pages@v3
4870
with:
@@ -62,7 +84,7 @@ jobs:
6284
cp _build/jupyter/*.ipynb _build/lecture-python.notebooks
6385
ls -a _build/lecture-python.notebooks
6486
- name: Commit latest notebooks to lecture-python.notebooks
65-
uses: cpina/github-action-push-to-another-repository@master
87+
uses: cpina/github-action-push-to-another-repository@v1.3
6688
env:
6789
API_TOKEN_GITHUB: ${{ secrets.QUANTECON_SERVICES_PAT }}
6890
with:

environment.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ dependencies:
66
- anaconda=2020.11
77
- pip
88
- pip:
9-
- jupyter-book
10-
- sphinx-multitoc-numbering
11-
- quantecon-book-theme
12-
- sphinx-tojupyter
13-
- sphinxext-rediraffe
14-
- sphinx-exercise
15-
- jupytext
16-
- ghp-import
17-
- jupinx
9+
- jupyter-book==0.11.1
10+
- sphinx-multitoc-numbering==0.1.3
11+
- quantecon-book-theme==0.2.3
12+
- sphinx-tojupyter==0.1.1
13+
- sphinxext-rediraffe==0.2.7
14+
- sphinx-exercise==0.1.1
15+
- jupytext==1.11.2
16+
- ghp-import==1.1.0
17+
- jupinx==0.2.3
1818
# Temporary Fixes
1919
- tornado>=6.1
2020

lectures/_config.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ bibtex_bibfiles:
1313
html:
1414
baseurl: https://python.quantecon.org/
1515

16+
latex:
17+
latex_documents:
18+
targetname: quantecon-python.tex
19+
1620
sphinx:
1721
extra_extensions: [sphinx_multitoc_numbering, sphinxext.rediraffe, sphinx_tojupyter]
1822
config:
@@ -56,7 +60,7 @@ sphinx:
5660
Macros:
5761
"argmax" : "arg\\,max"
5862
"argmin" : "arg\\,min"
59-
mathjax_path: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
63+
mathjax_path: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-svg.js
6064
rediraffe_redirects:
6165
index_toc.md: intro.md
6266
tojupyter_static_file_path: ["source/_static", "_static"]

lectures/linear_models.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ sample_size = 500_000
734734
ar = LinearStateSpace(A_2, C_2, G_2, mu_0=np.ones(4))
735735
fig, ax = plt.subplots()
736736
x, y = ar.simulate(sample_size)
737-
mu_x, mu_y, Sigma_x, Sigma_y = ar.stationary_distributions()
737+
mu_x, mu_y, Sigma_x, Sigma_y, Sigma_yx = ar.stationary_distributions()
738738
f_y = norm(loc=float(mu_y), scale=float(np.sqrt(Sigma_y)))
739739
y = y.flatten()
740740
ygrid = np.linspace(ymin, ymax, 150)
@@ -920,7 +920,7 @@ def cross_plot(A,
920920
ar = LinearStateSpace(A, C, G, mu_0=np.ones(4))
921921
922922
if steady_state == 'True':
923-
μ_x, μ_y, Σ_x, Σ_y = ar.stationary_distributions()
923+
μ_x, μ_y, Σ_x, Σ_y, Σ_yx = ar.stationary_distributions()
924924
ar_state = LinearStateSpace(A, C, G, mu_0=μ_x, Sigma_0=Σ_x)
925925
926926
ymin, ymax = -0.6, 0.6

lectures/navy_captain.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ In addition to what's in Anaconda, this lecture will need the following librarie
3131
tags: [hide-output]
3232
---
3333
!conda install -y quantecon
34+
!conda install -y -c conda-forge interpolation
3435
```
3536

3637
```{code-cell} ipython

lectures/perm_income_cons.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ G = np.array([[0., 1., 0.]])
345345
μ_z0 = np.array([[1.0], [0.0], [0.0]])
346346
Σ_z0 = np.zeros((3, 3))
347347
Lz = qe.LinearStateSpace(A, C, G, mu_0=μ_z0, Sigma_0=Σ_z0)
348-
μ_z, μ_y, Σ_z, Σ_y = Lz.stationary_distributions()
348+
μ_z, μ_y, Σ_z, Σ_y, Σ_yx = Lz.stationary_distributions()
349349
350350
# Mean vector of state for the savings problem
351351
mxo = np.vstack([μ_z, 0.0])

lectures/samuelson.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1316,7 +1316,7 @@ class SamuelsonLSS(LinearStateSpace):
13161316
# values for simulation
13171317
if stationary == True:
13181318
try:
1319-
self.μ_x, self.μ_y, self.σ_x, self.σ_y = \
1319+
self.μ_x, self.μ_y, self.σ_x, self.σ_y, self.σ_yx = \
13201320
self.stationary_distributions()
13211321
self.μ_0 = self.μ_y
13221322
self.Σ_0 = self.σ_y

0 commit comments

Comments
 (0)