Skip to content

Commit 0df9946

Browse files
authored
Merge branch 'main' into match_transport_formula
2 parents 26536bc + c48ad74 commit 0df9946

27 files changed

Lines changed: 2889 additions & 416 deletions

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,16 @@ updates:
1111
prefix: ⬆️
1212
schedule:
1313
interval: weekly
14+
15+
- package-ecosystem: "conda"
16+
directory: "/"
17+
commit-message:
18+
prefix: ⬆️
19+
schedule:
20+
interval: weekly
21+
ignore:
22+
- dependency-name: "jupyter-book"
23+
versions: [">=2.0"]
24+
- dependency-name: "python"
25+
# Python version should be constrained by the anaconda distribution version
26+
versions: [">0"]

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ jobs:
88
steps:
99
- name: Checkout
1010
uses: actions/checkout@v5
11+
with:
12+
fetch-depth: 0
1113
- name: Setup Anaconda
1214
uses: conda-incubator/setup-miniconda@v3
1315
with:

.github/workflows/publish.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ jobs:
1010
steps:
1111
- name: Checkout
1212
uses: actions/checkout@v5
13+
with:
14+
fetch-depth: 0
1315
- name: Setup Anaconda
1416
uses: conda-incubator/setup-miniconda@v3
1517
with:
@@ -72,6 +74,32 @@ jobs:
7274
run: |
7375
rm -r _build/.doctrees
7476
jb build lectures --path-output ./
77+
# Create HTML archive for release assets
78+
- name: Create HTML archive
79+
shell: bash -l {0}
80+
run: |
81+
tar -czf lecture-python-advanced-html-${{ github.ref_name }}.tar.gz -C _build/html .
82+
sha256sum lecture-python-advanced-html-${{ github.ref_name }}.tar.gz > html-checksum.txt
83+
84+
# Create metadata manifest
85+
cat > html-manifest.json << EOF
86+
{
87+
"tag": "${{ github.ref_name }}",
88+
"commit": "${{ github.sha }}",
89+
"timestamp": "$(date -Iseconds)",
90+
"size_mb": $(du -sm _build/html | cut -f1),
91+
"file_count": $(find _build/html -type f | wc -l)
92+
}
93+
EOF
94+
- name: Upload archives to release
95+
uses: softprops/action-gh-release@v1
96+
with:
97+
files: |
98+
lecture-python-advanced-html-${{ github.ref_name }}.tar.gz
99+
html-checksum.txt
100+
html-manifest.json
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75103
- name: Deploy website to gh-pages
76104
uses: peaceiris/actions-gh-pages@v4
77105
with:

.github/workflows/style-guide.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
if: contains(github.event.comment.body, '@qe-style-checker')
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: QuantEcon/action-style-guide@v0.3
13+
- uses: QuantEcon/action-style-guide@v0.5
1414
with:
1515
mode: 'single'
1616
lectures-path: 'lectures/'
1717
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
1818
github-token: ${{ secrets.GITHUB_TOKEN }}
19-
comment-body: ${{ github.event.comment.body || github.event.issue.body }}
19+
comment-body: ${{ github.event.comment.body || github.event.issue.body }}

environment.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@ channels:
33
- default
44
dependencies:
55
- python=3.13
6-
- anaconda=2025.06
6+
- anaconda=2025.12
77
- pip
88
- pip:
9-
- jupyter-book==1.0.4post1
10-
- quantecon-book-theme==0.9.3
11-
- sphinx-tojupyter==0.3.1
12-
- sphinxext-rediraffe==0.2.7
13-
- sphinx-exercise==1.0.1
14-
- sphinx-proof==0.2.1
9+
- jupyter-book>=1.0.4post1,<2.0
10+
- quantecon-book-theme==0.15.1
11+
- sphinx-tojupyter==0.6.0
12+
- sphinxext-rediraffe==0.3.0
13+
- sphinx-exercise==1.2.1
14+
- sphinx-proof==0.3.0
1515
- sphinxcontrib-youtube==1.4.1
1616
- sphinx-togglebutton==0.3.2
17-
- sphinx-reredirects==0.1.4
17+
- sphinx-reredirects==1.1.0
18+
- kaleido
1819

1920

lectures/BCG_complete_mkts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ fig.update_layout(width=500,
11941194
fig.update_layout(scene_camera=dict(eye=dict(x=2, y=-2, z=1.5)))
11951195
11961196
# Export to PNG file
1197-
Image(fig.to_image(format="png"))
1197+
Image(fig.to_image(format="png", engine="kaleido"))
11981198
# fig.show() will provide interactive plot when running
11991199
# notebook locally
12001200
```

lectures/BCG_incomplete_mkts.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,7 @@ fig.update_layout(scene_camera=dict(eye=dict(x=1.5, y=-1.5, z=2)))
12701270
fig.update_layout(title='Equilibrium firm valuation for the grid of (k,b)')
12711271
12721272
# Export to PNG file
1273-
Image(fig.to_image(format="png"))
1273+
Image(fig.to_image(format="png", engine="kaleido"))
12741274
# fig.show() will provide interactive plot when running
12751275
# code locally
12761276
```
@@ -1634,7 +1634,7 @@ fig.update_layout(title='Equilibrium firm valuation for the grid of (k,b)')
16341634
16351635
16361636
# Export to PNG file
1637-
Image(fig.to_image(format="png"))
1637+
Image(fig.to_image(format="png", engine="kaleido"))
16381638
# fig.show() will provide interactive plot when running
16391639
# code locally
16401640
```
@@ -1685,7 +1685,7 @@ fig.update_layout(scene_camera=dict(eye=dict(x=1.5, y=-1.5, z=2)))
16851685
fig.update_layout(title='Equilibrium firm valuation for the grid of (k,b)')
16861686
16871687
# Export to PNG file
1688-
Image(fig.to_image(format="png"))
1688+
Image(fig.to_image(format="png", engine="kaleido"))
16891689
# fig.show() will provide interactive plot when running
16901690
# code locally
16911691
```
@@ -1746,7 +1746,7 @@ fig.update_layout(title='Equilibrium equity valuation for the grid of (k,b)')
17461746
17471747
17481748
# Export to PNG file
1749-
Image(fig.to_image(format="png"))
1749+
Image(fig.to_image(format="png", engine="kaleido"))
17501750
# fig.show() will provide interactive plot when running
17511751
# code locally
17521752
```
@@ -1776,7 +1776,7 @@ fig.update_layout(title='Equilibrium bond valuation for the grid of (k,b)')
17761776
17771777
17781778
# Export to PNG file
1779-
Image(fig.to_image(format="png"))
1779+
Image(fig.to_image(format="png", engine="kaleido"))
17801780
# fig.show() will provide interactive plot when running
17811781
# code locally
17821782
```

lectures/_config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ sphinx:
3939
'https://doi.org/10.1086/262078',
4040
'https://keras.io/',
4141
'https://data.oecd.org/']
42+
nb_merge_streams: true
4243
nb_mime_priority_overrides: [
4344
# HTML
4445
['html', 'application/vnd.jupyter.widget-view+json', 10],
@@ -85,6 +86,7 @@ sphinx:
8586
header_organisation: QuantEcon
8687
repository_url: https://github.com/QuantEcon/lecture-python-advanced.myst
8788
nb_repository_url: https://github.com/QuantEcon/lecture-python-advanced.notebooks
89+
path_to_docs: lectures
8890
twitter: quantecon
8991
twitter_logo_url: https://assets.quantecon.org/img/qe-twitter-logo.png
9092
og_logo_url: https://assets.quantecon.org/img/qe-og-logo.png
@@ -116,6 +118,8 @@ sphinx:
116118
"gG": "\\mathcal{G}"
117119
"hH": "\\mathcal{H}"
118120
mathjax_path: https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js
121+
# sphinx-exercise
122+
exercise_style: "solution_follow_exercise"
119123
rediraffe_redirects:
120124
index_toc.md: intro.md
121125
tojupyter_static_file_path: ["source/_static", "_static"]

lectures/_static/.DS_Store

0 Bytes
Binary file not shown.

lectures/_static/lecture_specific/amss2/recursive_allocation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,15 @@ def objf_prime(x):
231231

232232
epsilon = 1e-7
233233
x0 = np.asarray(x, dtype=float)
234-
f0 = np.atleast_1d(objf(x0))
235-
jac = np.zeros([len(x0), len(f0)])
234+
f0 = objf(x0)
235+
grad = np.zeros(len(x0))
236236
dx = np.zeros(len(x0))
237237
for i in range(len(x0)):
238238
dx[i] = epsilon
239-
jac[i] = (objf(x0+dx) - f0)/epsilon
239+
grad[i] = (objf(x0+dx) - f0)/epsilon
240240
dx[i] = 0.0
241241

242-
return jac.transpose()
242+
return grad
243243

244244
def cons(z):
245245
c, n, xprime, T = z[:S], z[S:2 * S], z[2 * S:3 * S], z[3 * S:]

0 commit comments

Comments
 (0)