Skip to content

Commit d99152c

Browse files
authored
ENH: Build download notebooks using sphinx-tojupyter (#100)
* update configuration for download notebooks * enable pdf production * update ci, enable download notebooks * update anaconda * migrate to use jupyter raw directives * add test run for theme branch * fix test run of branch * enable html targetting * remove pdf templates and settings for now and deploy in a different PR
1 parent 83572db commit d99152c

22 files changed

+52
-25
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,21 @@ jobs:
77
- name: Checkout
88
uses: actions/checkout@v2
99
- name: Setup Anaconda
10-
uses: goanpeca/setup-miniconda@v1
10+
uses: conda-incubator/setup-miniconda@v2
1111
with:
1212
auto-update-conda: true
1313
auto-activate-base: true
1414
miniconda-version: 'latest'
1515
python-version: 3.8
1616
environment-file: environment.yml
17-
activate-environment: qe-lectures
17+
activate-environment: lecture-python-programming
18+
- name: Install QuantEcon Book Theme
19+
shell: bash -l {0}
20+
run: |
21+
git clone https://github.com/quantecon/quantecon-book-theme
22+
cd quantecon-book-theme && git checkout download-nb
23+
python setup.py install
24+
cd .. && rm -r quantecon-book-theme
1825
- name: Display Conda Environment Versions
1926
shell: bash -l {0}
2027
run: conda list
@@ -25,6 +32,12 @@ jobs:
2532
shell: bash -l {0}
2633
run: |
2734
jb build lectures --path-output ./
35+
- name: Build Download Notebooks (sphinx-tojupyter)
36+
shell: bash -l {0}
37+
run: |
38+
jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter
39+
mkdir _build/html/_notebooks
40+
cp _build/jupyter/*.ipynb _build/html/_notebooks
2841
- name: Preview Deploy to Netlify
2942
uses: nwtgck/actions-netlify@v1.1
3043
with:

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
_build/
22
__pycache__/
3-
.DS_Store
3+
.DS_Store
4+
dask-worker-space

environment.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
name: qe-lectures
1+
name: lecture-python-programming
22
channels:
33
- default
44
dependencies:
55
- python=3.8
66
- anaconda=2020.07
77
- pip
88
- pip:
9-
- jupyter-book
9+
- git+https://github.com/executablebooks/jupyter-book.git
1010
- sphinxext-rediraffe
1111
- git+https://github.com/executablebooks/sphinx-multitoc-numbering
12-
- git+https://github.com/quantecon/quantecon-book-theme
1312
- git+https://github.com/executablebooks/sphinx-exercise.git
1413
- joblib
1514
- interpolation
15+
- git+https://github.com/QuantEcon/sphinx-tojupyter.git
1616

lectures/_config.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ html:
1212
baseurl: https://python.quantecon.org/
1313

1414
sphinx:
15-
extra_extensions: [sphinx_multitoc_numbering, sphinx_exercise, sphinxext.rediraffe]
15+
extra_extensions: [sphinx_multitoc_numbering, sphinx_exercise, sphinxext.rediraffe, sphinx_tojupyter]
1616
config:
1717
html_favicon: _static/lectures-favicon.ico
1818
html_theme: quantecon_book_theme
@@ -29,3 +29,16 @@ sphinx:
2929
google_analytics_id: UA-54984338-9
3030
rediraffe_redirects:
3131
index_toc.md: intro.md
32+
tojupyter_static_file_path: ["source/_static", "_static"]
33+
tojupyter_target_html: true
34+
tojupyter_urlpath: "https://python-programming.quantecon.org/"
35+
tojupyter_image_urlpath: "https://python-programming.quantecon.org/_static/"
36+
tojupyter_lang_synonyms: ["ipython", "ipython3", "python"]
37+
tojupyter_kernels:
38+
python3:
39+
kernelspec:
40+
display_name: "Python"
41+
language: python3
42+
name: python3
43+
file_extension: ".py"
44+
tojupyter_images_markdown: true

lectures/about_py.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ kernelspec:
1010
---
1111

1212
(about_py)=
13-
```{raw} html
13+
```{raw} jupyter
1414
<div id="qe-notebook-header" align="right" style="text-align:right;">
1515
<a href="https://quantecon.org/" title="quantecon.org">
1616
<img style="width:250px;display:inline;" width="250px" src="https://assets.quantecon.org/img/qe-menubar-logo.svg" alt="QuantEcon">

lectures/debugging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ kernelspec:
1010
---
1111

1212
(debugging)=
13-
```{raw} html
13+
```{raw} jupyter
1414
<div id="qe-notebook-header" align="right" style="text-align:right;">
1515
<a href="https://quantecon.org/" title="quantecon.org">
1616
<img style="width:250px;display:inline;" width="250px" src="https://assets.quantecon.org/img/qe-menubar-logo.svg" alt="QuantEcon">

lectures/functions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ kernelspec:
1010
---
1111

1212
(functions)=
13-
```{raw} html
13+
```{raw} jupyter
1414
<div id="qe-notebook-header" align="right" style="text-align:right;">
1515
<a href="https://quantecon.org/" title="quantecon.org">
1616
<img style="width:250px;display:inline;" width="250px" src="https://assets.quantecon.org/img/qe-menubar-logo.svg" alt="QuantEcon">

lectures/getting_started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ kernelspec:
1010
---
1111

1212
(getting_started)=
13-
```{raw} html
13+
```{raw} jupyter
1414
<div id="qe-notebook-header" align="right" style="text-align:right;">
1515
<a href="https://quantecon.org/" title="quantecon.org">
1616
<img style="width:250px;display:inline;" width="250px" src="https://assets.quantecon.org/img/qe-menubar-logo.svg" alt="QuantEcon">

lectures/matplotlib.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ kernelspec:
1010
---
1111

1212
(matplotlib)=
13-
```{raw} html
13+
```{raw} jupyter
1414
<div id="qe-notebook-header" align="right" style="text-align:right;">
1515
<a href="https://quantecon.org/" title="quantecon.org">
1616
<img style="width:250px;display:inline;" width="250px" src="https://assets.quantecon.org/img/qe-menubar-logo.svg" alt="QuantEcon">

lectures/need_for_speed.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ kernelspec:
1010
---
1111

1212
(speed)=
13-
```{raw} html
13+
```{raw} jupyter
1414
<div id="qe-notebook-header" align="right" style="text-align:right;">
1515
<a href="https://quantecon.org/" title="quantecon.org">
1616
<img style="width:250px;display:inline;" width="250px" src="https://assets.quantecon.org/img/qe-menubar-logo.svg" alt="QuantEcon">

0 commit comments

Comments
 (0)