Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build Cache [using jupyter-book]
on:
push:
branches:
- main
jobs:
cache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Setup Anaconda
uses: conda-incubator/setup-miniconda@v4
with:
auto-update-conda: true
auto-activate-base: true
miniconda-version: 'latest'
python-version: "3.13"
environment-file: environment.yml
activate-environment: quantecon
- name: Build HTML
shell: bash -l {0}
run: |
jb build lectures --path-output ./ --keep-going
# TODO: Re-enable -W flag once all lectures are translated and warnings are resolved
- name: Upload Execution Reports
uses: actions/upload-artifact@v7
if: failure()
with:
name: execution-reports
path: _build/html/reports
- name: Upload "_build" folder (cache)
uses: actions/upload-artifact@v7
with:
name: build-cache
path: _build
include-hidden-files: true
137 changes: 137 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: Build & Publish to GH Pages
on:
push:
tags:
- 'publish*'
jobs:
publish:
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Anaconda
uses: conda-incubator/setup-miniconda@v4
with:
auto-update-conda: true
auto-activate-base: true
miniconda-version: 'latest'
python-version: "3.13"
environment-file: environment.yml
activate-environment: quantecon
- name: Install latex dependencies
run: |
sudo apt-get -qq update
sudo apt-get install -y \
texlive-latex-recommended \
texlive-latex-extra \
texlive-fonts-recommended \
texlive-fonts-extra \
texlive-xetex \
latexmk \
xindy \
dvipng \
cm-super
Comment thread
mmcky marked this conversation as resolved.
Outdated
- name: Display Conda Environment Versions
shell: bash -l {0}
run: conda list
- name: Display Pip Versions
shell: bash -l {0}
run: pip list
# Download Build Cache from cache.yml
- name: Download "build" folder (cache)
uses: dawidd6/action-download-artifact@v21
with:
workflow: cache.yml
branch: main
name: build-cache
path: _build
Comment thread
mmcky marked this conversation as resolved.
# TODO: pdf support
# # Build Assets (Download Notebooks, PDF via LaTeX)
# - name: Build PDF from LaTeX
# shell: bash -l {0}
# run: |
# jb build lectures --builder pdflatex --path-output ./ -n -W --keep-going
# - name: Copy LaTeX PDF for GH-PAGES
# shell: bash -l {0}
# run: |
# mkdir -p _build/html/_pdf
# cp -u _build/latex/*.pdf _build/html/_pdf
# TODO: download notebook support
# - name: Build Download Notebooks (sphinx-tojupyter)
# shell: bash -l {0}
# run: |
# jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter -n -W --keep-going
# zip -r download-notebooks.zip _build/jupyter
# - uses: actions/upload-artifact@v4
# with:
# name: download-notebooks
# path: download-notebooks.zip
# - name: Copy Download Notebooks for GH-PAGES
# shell: bash -l {0}
# run: |
# mkdir -p _build/html/_notebooks
# cp -u _build/jupyter/*.ipynb _build/html/_notebooks
# Final Build of HTML (with assets)
- name: Build HTML
shell: bash -l {0}
run: |
jb build lectures --path-output ./ -n --keep-going
# TODO: Re-enable -W flag once all lectures are translated and warnings are resolved
# Create HTML archive for release assets
- name: Create HTML archive
shell: bash -l {0}
run: |
tar -czf lecture-python-programming-fr-html-${{ github.ref_name }}.tar.gz -C _build/html .
sha256sum lecture-python-programming-fr-html-${{ github.ref_name }}.tar.gz > html-checksum.txt

# Create metadata manifest
cat > html-manifest.json << EOF
{
"tag": "${{ github.ref_name }}",
"commit": "${{ github.sha }}",
"timestamp": "$(date -Iseconds)",
"size_mb": $(du -sm _build/html | cut -f1),
"file_count": $(find _build/html -type f | wc -l)
}
EOF
- name: Upload archives to release
uses: softprops/action-gh-release@v3
with:
files: |
lecture-python-programming-fr-html-${{ github.ref_name }}.tar.gz
html-checksum.txt
html-manifest.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy website to gh-pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _build/html/
# cname: python-programming-fr.quantecon.org # enable together with the _config.yml baseurl flip once DNS is decided
# TODO: download notebook support
# - name: Prepare lecture-python-programming.notebooks sync
# shell: bash -l {0}
# run: |
# mkdir -p _build/lecture-python-programming.notebooks
# cp -a _notebook_repo/. _build/lecture-python-programming.notebooks
# cp _build/jupyter/*.ipynb _build/lecture-python-programming.notebooks
# ls -a _build/lecture-python-programming.notebooks
# - name: Commit notebooks to lecture-python-programming.notebooks
# shell: bash -l {0}
# env:
# QE_SERVICES_PAT: ${{ secrets.QUANTECON_SERVICES_PAT }}
# run: |
# git clone https://quantecon-services:$QE_SERVICES_PAT@github.com/quantecon/lecture-python-programming.notebooks

# cp _build/lecture-python-programming.notebooks/*.ipynb lecture-python-programming.notebooks

# cd lecture-python-programming.notebooks
# git config user.name "QuantEcon Services"
# git config user.email "admin@quantecon.org"
# git add *.ipynb
# git commit -m "auto publishing updates to notebooks"
# git push origin main
17 changes: 17 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: quantecon
channels:
- default
dependencies:
- python=3.13
- anaconda=2026.06
- pip
- pip:
- jupyter-book>=1.0.4post1,<2.0
- quantecon-book-theme==0.21.0
- sphinx-tojupyter==0.6.0
- sphinxext-rediraffe==0.3.0
- sphinx-exercise==1.2.1
- sphinxcontrib-youtube==1.5.0
- sphinx-togglebutton==0.4.5


15 changes: 9 additions & 6 deletions lectures/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ execute:
timeout: 600 # 10 minutes

html:
baseurl: https://python-programming.quantecon.org/
# TODO: flip to https://python-programming-fr.quantecon.org/ together with the
# publish.yml cname once the custom-domain DNS is set up
baseurl: https://quantecon.github.io/lecture-python-programming.fr/

latex:
latex_documents:
targetname: quantecon-python-programming.tex
targetname: quantecon-python-programming-fr.tex

sphinx:
extra_extensions: [sphinx_multitoc_numbering, sphinxext.rediraffe, sphinx_tojupyter, sphinx_exercise, sphinx_togglebutton, sphinx.ext.intersphinx]
config:
language: fr
# bibtex_reference_style: author_year #TODO: enable if bibtex bibliography is used in series
# false-positive links
linkcheck_ignore: ['https://github.com/matplotlib/matplotlib/blob/v3.6.2/lib/matplotlib/axes/_axes.py#L1417-L1669',
Expand All @@ -43,8 +46,8 @@ sphinx:
dark_logo: quantecon-logo-transparent.png
header_organisation_url: https://quantecon.org
header_organisation: QuantEcon
repository_url: https://github.com/QuantEcon/lecture-python-programming
nb_repository_url: https://github.com/QuantEcon/lecture-python-programming.notebooks
repository_url: https://github.com/QuantEcon/lecture-python-programming.fr
nb_repository_url: https://github.com/QuantEcon/lecture-python-programming.fr.notebooks
Comment thread
mmcky marked this conversation as resolved.
Outdated
path_to_docs: lectures
twitter: quantecon
twitter_logo_url: https://assets.quantecon.org/img/qe-twitter-logo.png
Expand All @@ -67,8 +70,8 @@ sphinx:
index_toc.md: intro.md
tojupyter_static_file_path: ["source/_static", "_static"]
tojupyter_target_html: true
tojupyter_urlpath: "https://python-programming.quantecon.org/"
tojupyter_image_urlpath: "https://python-programming.quantecon.org/_static/"
tojupyter_urlpath: "https://quantecon.github.io/lecture-python-programming.fr/"
tojupyter_image_urlpath: "https://quantecon.github.io/lecture-python-programming.fr/_static/"
tojupyter_lang_synonyms: ["ipython", "ipython3", "python"]
tojupyter_kernels:
python3:
Expand Down