Skip to content

Commit 387e084

Browse files
committed
update lecture series
1 parent 250a659 commit 387e084

File tree

202 files changed

+87621
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+87621
-0
lines changed

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: github-actions
9+
directory: /
10+
commit-message:
11+
prefix: ⬆️
12+
schedule:
13+
interval: weekly

.github/workflows/cache.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Build Cache [using jupyter-book]
2+
on:
3+
schedule:
4+
# Execute cache weekly at 3am on Monday
5+
- cron: '0 3 * * 1'
6+
jobs:
7+
cache:
8+
runs-on: quantecon-gpu
9+
container:
10+
image: ghcr.io/quantecon/lecture-python-container:cuda-12.6.0-anaconda-2024-10-py312-b
11+
options: --gpus all
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
ref: ${{ github.event.pull_request.head.sha }}
16+
- name: Check nvidia drivers
17+
shell: bash -l {0}
18+
run: |
19+
nvidia-smi
20+
- name: Build HTML
21+
shell: bash -l {0}
22+
run: |
23+
jb build lectures --path-output ./ -W --keep-going
24+
- name: Upload Execution Reports
25+
uses: actions/upload-artifact@v4
26+
if: failure()
27+
with:
28+
name: execution-reports
29+
path: _build/html/reports
30+
- name: Upload "_build" folder (cache)
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: build-cache
34+
path: _build
35+
include-hidden-files: true

.github/workflows/ci.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Build Project [using jupyter-book]
2+
on: [pull_request]
3+
jobs:
4+
preview:
5+
runs-on: quantecon-gpu
6+
container:
7+
image: ghcr.io/quantecon/lecture-python-container:cuda-12.6.0-anaconda-2024-10-py312-b
8+
options: --gpus all
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
ref: ${{ github.event.pull_request.head.sha }}
13+
# Check nvidia drivers
14+
- name: nvidia Drivers
15+
shell: bash -l {0}
16+
run: nvidia-smi
17+
- name: Display Conda Environment Versions
18+
shell: bash -l {0}
19+
run: conda list
20+
- name: Display Pip Versions
21+
shell: bash -l {0}
22+
run: pip list
23+
- name: Download "build" folder (cache)
24+
uses: dawidd6/action-download-artifact@v7
25+
with:
26+
workflow: cache.yml
27+
branch: main
28+
name: build-cache
29+
path: _build
30+
# Build Assets (Download Notebooks and PDF via LaTeX)
31+
- name: Build Download Notebooks (sphinx-tojupyter)
32+
shell: bash -l {0}
33+
run: |
34+
jb build lectures -n -W --keep-going --path-output ./ --builder=custom --custom-builder=jupyter
35+
mkdir -p _build/html/_notebooks
36+
cp -u _build/jupyter/*.ipynb _build/html/_notebooks
37+
- name: Upload Execution Reports (Download Notebooks)
38+
uses: actions/upload-artifact@v4
39+
if: failure()
40+
with:
41+
name: execution-reports
42+
path: _build/jupyter/reports
43+
- name: Build PDF from LaTeX
44+
shell: bash -l {0}
45+
run: |
46+
jb build lectures --builder pdflatex --path-output ./ -W --keep-going
47+
mkdir -p _build/html/_pdf
48+
cp -u _build/latex/*.pdf _build/html/_pdf
49+
- name: Upload Execution Reports (LaTeX)
50+
uses: actions/upload-artifact@v4
51+
if: failure()
52+
with:
53+
name: execution-reports
54+
path: _build/latex/reports
55+
# Final Build of HTML
56+
- name: Build HTML
57+
shell: bash -l {0}
58+
run: |
59+
jb build lectures --path-output ./ -n -W --keep-going
60+
- name: Upload Execution Reports (HTML)
61+
uses: actions/upload-artifact@v4
62+
if: failure()
63+
with:
64+
name: execution-reports
65+
path: _build/html/reports
66+
- name: Preview Deploy to Netlify
67+
uses: nwtgck/actions-netlify@v3
68+
with:
69+
publish-dir: '_build/html/'
70+
production-branch: main
71+
github-token: ${{ secrets.GITHUB_TOKEN }}
72+
deploy-message: "Preview Deploy from GitHub Actions"
73+
env:
74+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
75+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

.github/workflows/collab.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Build Project on Google Collab (Execution)
2+
on: [pull_request]
3+
jobs:
4+
execution-checks:
5+
runs-on: quantecon-gpu
6+
container:
7+
image: docker://us-docker.pkg.dev/colab-images/public/runtime
8+
options: --gpus all
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
ref: ${{ github.event.pull_request.head.sha }}
13+
- name: Check nvidia drivers
14+
shell: bash -l {0}
15+
run: |
16+
nvidia-smi
17+
- name: Check python version
18+
shell: bash -l {0}
19+
run: |
20+
python --version
21+
- name: Display Pip Versions
22+
shell: bash -l {0}
23+
run: pip list
24+
- name: Download "build" folder (cache)
25+
uses: dawidd6/action-download-artifact@v7
26+
with:
27+
workflow: cache.yml
28+
branch: main
29+
name: build-cache
30+
path: _build
31+
# Install build software
32+
- name: Install Build Software
33+
shell: bash -l {0}
34+
run: |
35+
pip install jupyter-book==0.15.1 docutils==0.17.1 quantecon-book-theme==0.7.2 sphinx-tojupyter==0.3.0 sphinxext-rediraffe==0.2.7 sphinx-reredirects sphinx-exercise==0.4.1 sphinxcontrib-youtube==1.1.0 sphinx-togglebutton==0.3.1 arviz==0.13.0 sphinx-proof
36+
# Build of HTML (Execution Testing)
37+
- name: Build HTML
38+
shell: bash -l {0}
39+
run: |
40+
jb build lectures --path-output ./ -n -W --keep-going
41+
- name: Upload Execution Reports
42+
uses: actions/upload-artifact@v4
43+
if: failure()
44+
with:
45+
name: execution-reports
46+
path: _build/html/reports
47+
- name: Preview Deploy to Netlify
48+
uses: nwtgck/actions-netlify@v3
49+
with:
50+
publish-dir: '_build/html/'
51+
production-branch: main
52+
github-token: ${{ secrets.GITHUB_TOKEN }}
53+
deploy-message: "Preview Deploy from GitHub Actions"
54+
env:
55+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
56+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

.github/workflows/linkcheck.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Link Checker [Anaconda, Linux]
2+
on:
3+
pull_request:
4+
types: [opened, reopened]
5+
schedule:
6+
# UTC 12:00 is early morning in Australia
7+
- cron: '0 12 * * *'
8+
jobs:
9+
link-check-linux:
10+
name: Link Checking (${{ matrix.python-version }}, ${{ matrix.os }})
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
os: ["ubuntu-latest"]
16+
python-version: ["3.12"]
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
- name: Setup Anaconda
21+
uses: conda-incubator/setup-miniconda@v2
22+
with:
23+
auto-update-conda: true
24+
auto-activate-base: true
25+
miniconda-version: 'latest'
26+
python-version: '3.12'
27+
environment-file: environment.yml
28+
activate-environment: quantecon
29+
- name: Download "build" folder (cache)
30+
uses: dawidd6/action-download-artifact@v7
31+
with:
32+
workflow: cache.yml
33+
branch: main
34+
name: build-cache
35+
path: _build
36+
- name: Link Checker
37+
shell: bash -l {0}
38+
run: jb build lectures --path-output=./ --builder=custom --custom-builder=linkcheck
39+
- name: Upload Link Checker Reports
40+
uses: actions/upload-artifact@v4
41+
if: failure()
42+
with:
43+
name: linkcheck-reports
44+
path: _build/linkcheck

.github/workflows/publish.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Build & Publish to GH Pages
2+
on:
3+
push:
4+
tags:
5+
- 'publish*'
6+
jobs:
7+
publish:
8+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
9+
runs-on: quantecon-gpu
10+
container:
11+
image: ghcr.io/quantecon/lecture-python-container:cuda-12.6.0-anaconda-2024-10-py312-b
12+
options: --gpus all
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
- name: Install Git (required to commit notebooks)
17+
shell: bash -l {0}
18+
run: apt-get install -y git
19+
- name: Check nvidia drivers
20+
shell: bash -l {0}
21+
run: |
22+
nvidia-smi
23+
- name: Display Conda Environment Versions
24+
shell: bash -l {0}
25+
run: conda list
26+
- name: Display Pip Versions
27+
shell: bash -l {0}
28+
run: pip list
29+
# Download Build Cache from cache.yml
30+
- name: Download "build" folder (cache)
31+
uses: dawidd6/action-download-artifact@v7
32+
with:
33+
workflow: cache.yml
34+
branch: main
35+
name: build-cache
36+
path: _build
37+
# Build Assets (Download Notebooks, PDF via LaTeX)
38+
- name: Build PDF from LaTeX
39+
shell: bash -l {0}
40+
run: |
41+
jb build lectures --builder pdflatex --path-output ./ -n -W --keep-going
42+
- name: Copy LaTeX PDF for GH-PAGES
43+
shell: bash -l {0}
44+
run: |
45+
mkdir -p _build/html/_pdf
46+
cp -u _build/latex/*.pdf _build/html/_pdf
47+
- name: Build Download Notebooks (sphinx-tojupyter)
48+
shell: bash -l {0}
49+
run: |
50+
jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter -n -W --keep-going
51+
zip -r download-notebooks.zip _build/jupyter
52+
- uses: actions/upload-artifact@v4
53+
with:
54+
name: download-notebooks
55+
path: download-notebooks.zip
56+
- name: Copy Download Notebooks for GH-PAGES
57+
shell: bash -l {0}
58+
run: |
59+
mkdir -p _build/html/_notebooks
60+
cp -u _build/jupyter/*.ipynb _build/html/_notebooks
61+
# Final Build of HTML (with assets)
62+
- name: Build HTML
63+
shell: bash -l {0}
64+
run: |
65+
jb build lectures --path-output ./ -n -W --keep-going
66+
- name: Deploy website to gh-pages
67+
uses: peaceiris/actions-gh-pages@v4
68+
with:
69+
github_token: ${{ secrets.GITHUB_TOKEN }}
70+
publish_dir: _build/html/
71+
cname: python.quantecon.org
72+
- name: Prepare lecture-python.notebooks sync
73+
shell: bash -l {0}
74+
run: |
75+
mkdir -p _build/lecture-python.notebooks
76+
cp -a _notebook_repo/. _build/lecture-python.notebooks
77+
cp _build/jupyter/*.ipynb _build/lecture-python.notebooks
78+
ls -a _build/lecture-python.notebooks
79+
- name: Commit notebooks to lecture-python.notebooks
80+
shell: bash -l {0}
81+
env:
82+
QE_SERVICES_PAT: ${{ secrets.QUANTECON_SERVICES_PAT }}
83+
run: |
84+
git clone https://quantecon-services:$QE_SERVICES_PAT@github.com/quantecon/lecture-python.notebooks
85+
86+
cp _build/lecture-python.notebooks/*.ipynb lecture-python.notebooks
87+
88+
cd lecture-python.notebooks
89+
git config user.name "QuantEcon Services"
90+
git config user.email "admin@quantecon.org"
91+
git add *.ipynb
92+
git commit -m "auto publishing updates to notebooks"
93+
git push origin main

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.DS_Store
2+
_build/
3+
lectures/_build/
4+
.ipynb_checkpoints/
5+
.virtual_documents/

_notebook_repo/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# lecture-python.notebooks
2+
3+
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/QuantEcon/lecture-python.notebooks/master)
4+
5+
Notebooks for https://python.quantecon.org
6+
7+
**Note:** This README should be edited [here](https://github.com/quantecon/lecture-python.myst/_notebook_repo)

_notebook_repo/environment.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
name: lecture-python
2+
channels:
3+
- default
4+
dependencies:
5+
- python=3.8
6+
- anaconda
7+

environment.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: quantecon
2+
channels:
3+
- default
4+
dependencies:
5+
- python=3.12
6+
- anaconda=2024.10
7+
- pip
8+
- pip:
9+
- jupyter-book==1.0.3
10+
- quantecon-book-theme==0.7.6
11+
- sphinx-tojupyter==0.3.0
12+
- sphinxext-rediraffe==0.2.7
13+
- sphinx-reredirects==0.1.4
14+
- sphinx-exercise==1.0.1
15+
- sphinx-proof==0.2.0
16+
- ghp-import==1.1.0
17+
- sphinxcontrib-youtube==1.3.0 #Version 1.3.0 is required as quantecon-book-theme is only compatible with sphinx<=5
18+
- sphinx-togglebutton==0.3.2
19+
# Docker Requirements
20+
- pytz
21+

0 commit comments

Comments
 (0)