Skip to content

Commit 1fbcc71

Browse files
committed
use qe theme
1 parent 8821a49 commit 1fbcc71

File tree

3 files changed

+43
-168
lines changed

3 files changed

+43
-168
lines changed

.github/workflows/ci_pr.yml

Lines changed: 19 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ name: Build and Netlify Deploy
33
on:
44
pull_request:
55
branches:
6-
- main
7-
paths:
8-
- book/**
9-
- requirements.txt
10-
- .github/workflows/deploy.yml
11-
- .github/workflows/ci_pr.yml
6+
- theme_updates
7+
push:
8+
branches:
9+
- theme_updates
1210
workflow_dispatch:
1311

1412
concurrency:
@@ -25,7 +23,8 @@ jobs:
2523
permissions:
2624
contents: read
2725
pull-requests: write
28-
26+
pushes: write
27+
2928
steps:
3029
- name: Checkout current branch
3130
uses: actions/checkout@v4
@@ -50,160 +49,31 @@ jobs:
5049
echo false >> EXTRA_CACHE_VARS.txt # archive
5150
cat EXTRA_CACHE_VARS.txt
5251
53-
- name: Cache page build
54-
id: cache-html
55-
uses: actions/cache@v4
56-
with:
57-
path: "book/_build/html"
58-
key: html-build-${{ github.head_ref }}-${{ hashFiles('book/**', 'requirements.txt', 'EXTRA_CACHE_VARS.txt') }}
59-
60-
- if: ${{ steps.cache-html.outputs.cache-hit != 'true' }}
61-
name: Set up Python 3.11
62-
uses: actions/setup-python@v5
63-
id: setup-python
64-
with:
65-
python-version: 3.11
66-
67-
- if: ${{ steps.cache-html.outputs.cache-hit != 'true' }}
68-
name: Record current date for cache
69-
run: |
70-
echo "WEEK=$(date +%V)" >> $GITHUB_ENV
71-
72-
- if: ${{ steps.cache-html.outputs.cache-hit != 'true' }}
73-
name: Cache virtualenv
74-
uses: actions/cache@v4
52+
- uses: actions/setup-node@v4
7553
with:
76-
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('requirements.txt') }}-week${{ env.WEEK }}-${{ github.repository }}
77-
path: .venv
54+
node-version: 18.x
7855

79-
- if: ${{ steps.cache-html.outputs.cache-hit != 'true' }}
80-
name: Install dependencies
56+
- name: Install MyST Markdown CLI
8157
run: |
82-
python -m venv .venv
83-
source .venv/bin/activate
84-
python -m pip install -r requirements.txt
85-
echo "$VIRTUAL_ENV/bin" >> $GITHUB_PATH
86-
echo "VIRTUAL_ENV=$VIRTUAL_ENV" >> $GITHUB_ENV
58+
npm install -g mystmd thebe-core thebe thebe-lite
8759
88-
- if: ${{ steps.cache-html.outputs.cache-hit != 'true' }}
89-
name: Build the book with TeachBooks
60+
- name: Build HTML
61+
working-directory: ./lectures
9062
run: |
91-
set -o pipefail
92-
# Build without preprocessing for PR preview
93-
teachbooks build book/ > >(tee stdout.log) 2> >(tee stderr.log >&2)
94-
set +o pipefail
63+
myst build
9564
96-
- name: If build failed, attempt to restore from cache
97-
if: failure()
98-
id: attempt-restore
99-
uses: actions/cache/restore@v4
65+
- name: Upload build output
66+
uses: actions/upload-pages-artifact@v3
10067
with:
101-
key: none
102-
path: "book/_build/html"
103-
restore-keys: html-build-${{ github.head_ref }}
104-
105-
- name: Check build output
106-
run: |
107-
echo "Build completed. Contents of book/_build/html/:"
108-
ls -la book/_build/html/ || echo "No build output found"
109-
echo "Checking for index.html:"
110-
ls -la book/_build/html/index.html || echo "No index.html found"
68+
path: './lectures/_build/html'
11169

112-
- name: Create build status summary
113-
if: always()
114-
run: |
115-
if [ ${{ job.status }} == 'success' ]; then
116-
echo "✅ **Build Status**: Success" >> build_summary.md
117-
echo "Book built successfully from branch \`${{ github.head_ref }}\`" >> build_summary.md
118-
else
119-
echo "**Build Status**: Failed" >> build_summary.md
120-
if [ -n "${{ steps.attempt-restore.outputs.cache-matched-key }}" ]; then
121-
echo "Using cached version from previous successful build" >> build_summary.md
122-
else
123-
echo " No cached version available" >> build_summary.md
124-
fi
125-
fi
126-
127-
if [ -s stderr.log ]; then
128-
echo "" >> build_summary.md
129-
echo " **Build Warnings/Errors**:" >> build_summary.md
130-
echo '```' >> build_summary.md
131-
cat stderr.log >> build_summary.md
132-
echo '```' >> build_summary.md
133-
fi
134-
135-
- name: Deploy to Netlify
136-
if: always() && hashFiles('book/_build/html/**') != ''
70+
- name: Preview Deploy to Netlify
13771
uses: nwtgck/actions-netlify@v3
13872
with:
139-
publish-dir: 'book/_build/html/'
73+
publish-dir: './lectures/_build/html'
14074
production-branch: main
14175
github-token: ${{ secrets.GITHUB_TOKEN }}
142-
deploy-message: "Preview Deploy from ${{ github.head_ref }} (PR #${{ github.event.number }})"
143-
alias: pr-${{ github.event.number }}
144-
enable-pull-request-comment: true
145-
enable-commit-comment: false
146-
overwrites-pull-request-comment: true
76+
deploy-message: "Preview Deploy from GitHub Actions"
14777
env:
14878
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
14979
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
150-
151-
- name: Comment build summary on PR
152-
if: always()
153-
uses: actions/github-script@v7
154-
with:
155-
script: |
156-
const fs = require('fs');
157-
let summary = '';
158-
try {
159-
summary = fs.readFileSync('build_summary.md', 'utf8');
160-
} catch (error) {
161-
summary = '📋 Build summary not available';
162-
}
163-
164-
const body = `## 🚀 TeachBooks Build & Deploy Summary
165-
166-
${summary}
167-
168-
---
169-
<details>
170-
<summary>📖 TeachBooks Configuration</summary>
171-
172-
- **Branch**: \`${{ github.head_ref }}\`
173-
- **Build Command**: \`teachbooks build book/\`
174-
- **Preprocessing**: Disabled (PR preview)
175-
- **Archive Banner**: Disabled (PR preview)
176-
- **Cache**: ${{ steps.cache-html.outputs.cache-hit == 'true' && 'Hit ✅' || 'Miss ❌' }}
177-
178-
</details>`;
179-
180-
// Get existing comments
181-
const { data: comments } = await github.rest.issues.listComments({
182-
owner: context.repo.owner,
183-
repo: context.repo.repo,
184-
issue_number: context.issue.number,
185-
});
186-
187-
// Find existing bot comment
188-
const botComment = comments.find(comment =>
189-
comment.user.type === 'Bot' &&
190-
comment.body.includes('🚀 TeachBooks Build & Deploy Summary')
191-
);
192-
193-
if (botComment) {
194-
// Update existing comment
195-
await github.rest.issues.updateComment({
196-
owner: context.repo.owner,
197-
repo: context.repo.repo,
198-
comment_id: botComment.id,
199-
body: body
200-
});
201-
} else {
202-
// Create new comment
203-
await github.rest.issues.createComment({
204-
owner: context.repo.owner,
205-
repo: context.repo.repo,
206-
issue_number: context.issue.number,
207-
body: body
208-
});
209-
}

lectures/cobweb.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ kernelspec:
99
display_name: Python 3 (ipykernel)
1010
language: python
1111
name: python3
12-
thebe:
13-
kernel: python3
1412
---
1513

1614

lectures/myst.yml

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
version: 1
22
project:
3-
title: A First Course in Quantitative Economics with Python
3+
title: A First Course in Quantitative Economics with Python - WASM
44
authors:
55
- name: Thomas J. Sargent
6+
affiliations:
7+
- Professor of Economics, New York University.
8+
- Senior Fellow, Hoover Institution, Stanford, CA.
69
url: http://www.tomsargent.com
7-
- name: John Stachurski
10+
- name: John Stachurski
11+
affiliations:
12+
- Professor, Research School of Economics, ANU.
13+
- Instructor for Ph.D. Advanced Macroeconomics, University of Minnesota.
814
url: https://johnstachurski.net
9-
github: https://github.com/QuantEcon/lecture-python-intro.myst
15+
16+
github: https://github.com/QuantEcon/project.lecture-wasm
1017

11-
# Thebe configuration for interactive execution
18+
# Thebe configuration
1219
thebe:
1320
lite: true
1421
kernel: python3
@@ -27,17 +34,17 @@ project:
2734
settingsStorageDrivers:
2835
- memory
2936
- localStorage
30-
31-
site:
32-
template: book-theme
33-
34-
# Enable Thebe in site options
35-
options:
36-
thebe: true
37-
38-
# Navigation structure
39-
nav:
40-
- file: lectures/intro.md
41-
- title: Economic Data
37+
toc:
38+
- file: intro.md
39+
- title: Introduction to Python
4240
children:
43-
- file: lectures/cobweb.md
41+
- file: cobweb.md
42+
numbering:
43+
titles: true
44+
headings: true
45+
heading_1: false
46+
figure:
47+
template: Fig. %s
48+
49+
site:
50+
template: https://github.com/QuantEcon/quantecon-theme/archive/refs/heads/main.zip

0 commit comments

Comments
 (0)