From 167dc0e46209965f8cfd40cc66b1a982e7f19a2b Mon Sep 17 00:00:00 2001 From: kp992 Date: Wed, 8 May 2024 15:01:43 +0530 Subject: [PATCH 01/17] Add collab testing --- .github/workflows/collab.yml | 54 ++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/collab.yml diff --git a/.github/workflows/collab.yml b/.github/workflows/collab.yml new file mode 100644 index 00000000..427826d2 --- /dev/null +++ b/.github/workflows/collab.yml @@ -0,0 +1,54 @@ +name: Build Project on Google Collab (Execution) +on: [pull_request] + +jobs: + test: + runs-on: ubuntu-latest-4core + container: + image: docker://us-docker.pkg.dev/colab-images/public/runtime + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + - name: Check python version + shell: bash -l {0} + run: | + python --version + - name: Display Pip Versions + shell: bash -l {0} + run: pip list + # - name: Download "build" folder (cache) + # uses: dawidd6/action-download-artifact@v3 + # with: + # workflow: cache.yml + # branch: main + # name: build-cache + # path: _build + # Install build software + - name: Install Build Software + shell: bash -l {0} + run: | + pip install jupyter-book==0.15.1 docutils==0.17.1 quantecon-book-theme==0.7.1 sphinx-tojupyter==0.3.0 sphinxext-rediraffe==0.2.7 sphinx-exercise==0.4.1 sphinxcontrib-youtube==1.1.0 sphinx-togglebutton==0.3.1 arviz==0.13.0 + # Build of HTML (Execution Testing) + - name: Build HTML + shell: bash -l {0} + run: | + jb build lectures --path-output ./ -n -W --keep-going + - name: Upload Execution Reports + uses: actions/upload-artifact@v4 + if: failure() + with: + name: execution-reports + path: _build/html/reports + - name: Preview Deploy to Netlify + uses: nwtgck/actions-netlify@v2 + with: + publish-dir: '_build/html/' + production-branch: main + github-token: ${{ secrets.GITHUB_TOKEN }} + deploy-message: "Preview Deploy from GitHub Actions" + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_S +ITE_ID }} +Footer From 741a97005112d905efc98ffb3b225827f8f598f2 Mon Sep 17 00:00:00 2001 From: kp992 Date: Wed, 8 May 2024 15:05:25 +0530 Subject: [PATCH 02/17] fix --- .github/workflows/collab.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/collab.yml b/.github/workflows/collab.yml index 427826d2..71515a28 100644 --- a/.github/workflows/collab.yml +++ b/.github/workflows/collab.yml @@ -49,6 +49,4 @@ jobs: deploy-message: "Preview Deploy from GitHub Actions" env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - NETLIFY_SITE_ID: ${{ secrets.NETLIFY_S -ITE_ID }} -Footer + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} From abe7ef68d35ee3b3b4f026e3a056cf3dab78578b Mon Sep 17 00:00:00 2001 From: Matt McKay Date: Thu, 9 May 2024 14:15:21 +1000 Subject: [PATCH 03/17] Update .github/workflows/collab.yml enabled larger runner for ubuntu --- .github/workflows/collab.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/collab.yml b/.github/workflows/collab.yml index 71515a28..026cd459 100644 --- a/.github/workflows/collab.yml +++ b/.github/workflows/collab.yml @@ -3,7 +3,7 @@ on: [pull_request] jobs: test: - runs-on: ubuntu-latest-4core + runs-on: ubuntu-latest-m container: image: docker://us-docker.pkg.dev/colab-images/public/runtime steps: From 32fdadf4b12c37c5ca09ae34f11359cd00c051a6 Mon Sep 17 00:00:00 2001 From: mmcky Date: Thu, 9 May 2024 14:36:29 +1000 Subject: [PATCH 04/17] add sphinx-proof --- .github/workflows/collab.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/collab.yml b/.github/workflows/collab.yml index 026cd459..110351db 100644 --- a/.github/workflows/collab.yml +++ b/.github/workflows/collab.yml @@ -28,7 +28,7 @@ jobs: - name: Install Build Software shell: bash -l {0} run: | - pip install jupyter-book==0.15.1 docutils==0.17.1 quantecon-book-theme==0.7.1 sphinx-tojupyter==0.3.0 sphinxext-rediraffe==0.2.7 sphinx-exercise==0.4.1 sphinxcontrib-youtube==1.1.0 sphinx-togglebutton==0.3.1 arviz==0.13.0 + pip install jupyter-book==0.15.1 docutils==0.17.1 quantecon-book-theme==0.7.1 sphinx-tojupyter==0.3.0 sphinxext-rediraffe==0.2.7 sphinx-exercise==0.4.1 sphinxcontrib-youtube==1.1.0 sphinx-togglebutton==0.3.1 arviz==0.13.0 sphinx_proof==0.1.3 # Build of HTML (Execution Testing) - name: Build HTML shell: bash -l {0} From 29e26054f724061f523f523c2b756ad5f376902c Mon Sep 17 00:00:00 2001 From: mmcky Date: Thu, 9 May 2024 14:56:37 +1000 Subject: [PATCH 05/17] enable build cache --- .github/workflows/collab.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/collab.yml b/.github/workflows/collab.yml index 110351db..581a8e4c 100644 --- a/.github/workflows/collab.yml +++ b/.github/workflows/collab.yml @@ -17,13 +17,13 @@ jobs: - name: Display Pip Versions shell: bash -l {0} run: pip list - # - name: Download "build" folder (cache) - # uses: dawidd6/action-download-artifact@v3 - # with: - # workflow: cache.yml - # branch: main - # name: build-cache - # path: _build + - name: Download "build" folder (cache) + uses: dawidd6/action-download-artifact@v3 + with: + workflow: cache.yml + branch: main + name: build-cache + path: _build # Install build software - name: Install Build Software shell: bash -l {0} From 3e1148e81ceaab2915600b4afd9a4e1bc4c3903b Mon Sep 17 00:00:00 2001 From: mmcky Date: Thu, 9 May 2024 15:17:02 +1000 Subject: [PATCH 06/17] FIX: fix import --- lectures/inflation_history.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lectures/inflation_history.md b/lectures/inflation_history.md index 2f57c0d3..033d1e52 100644 --- a/lectures/inflation_history.md +++ b/lectures/inflation_history.md @@ -28,8 +28,9 @@ This lecture also requires `pandas >= 2.1.4` ```{code-cell} ipython3 :tags: [hide-output] -from packaging.version import Version import pandas as pd +from packaging.version import Version +from importlib import reload if Version(pd.__version__) < Version('2.1.4'): !pip install pandas==2.1.4 reload(pandas) From b6c5bef6974052404496bafbf9786cbcf3784839 Mon Sep 17 00:00:00 2001 From: mmcky Date: Thu, 9 May 2024 15:27:37 +1000 Subject: [PATCH 07/17] FIX: pandas relaod --- lectures/inflation_history.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lectures/inflation_history.md b/lectures/inflation_history.md index 033d1e52..d7256da9 100644 --- a/lectures/inflation_history.md +++ b/lectures/inflation_history.md @@ -33,7 +33,7 @@ from packaging.version import Version from importlib import reload if Version(pd.__version__) < Version('2.1.4'): !pip install pandas==2.1.4 - reload(pandas) + reload('pandas') ``` We can then import the Python modules we will use. From 90c98318bf0c68405ebbddcc6ccc137f74033547 Mon Sep 17 00:00:00 2001 From: mmcky Date: Thu, 9 May 2024 15:41:21 +1000 Subject: [PATCH 08/17] Revert "FIX: pandas relaod" This reverts commit b6c5bef6974052404496bafbf9786cbcf3784839. --- lectures/inflation_history.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lectures/inflation_history.md b/lectures/inflation_history.md index d7256da9..033d1e52 100644 --- a/lectures/inflation_history.md +++ b/lectures/inflation_history.md @@ -33,7 +33,7 @@ from packaging.version import Version from importlib import reload if Version(pd.__version__) < Version('2.1.4'): !pip install pandas==2.1.4 - reload('pandas') + reload(pandas) ``` We can then import the Python modules we will use. From 3b9dd2185fe3eae8efe05d83ce4433a1373107a5 Mon Sep 17 00:00:00 2001 From: mmcky Date: Thu, 9 May 2024 15:46:08 +1000 Subject: [PATCH 09/17] FIX: update syntax --- lectures/inflation_history.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lectures/inflation_history.md b/lectures/inflation_history.md index 033d1e52..2834bac8 100644 --- a/lectures/inflation_history.md +++ b/lectures/inflation_history.md @@ -28,10 +28,10 @@ This lecture also requires `pandas >= 2.1.4` ```{code-cell} ipython3 :tags: [hide-output] -import pandas as pd +import pandas from packaging.version import Version from importlib import reload -if Version(pd.__version__) < Version('2.1.4'): +if Version(pandas.__version__) < Version('2.1.4'): !pip install pandas==2.1.4 reload(pandas) ``` From ef7b3541592bee6b17c5b8fb1643ca4f91480deb Mon Sep 17 00:00:00 2001 From: kp992 Date: Thu, 9 May 2024 16:21:08 +0530 Subject: [PATCH 10/17] pin pandas in CI --- .github/workflows/collab.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/collab.yml b/.github/workflows/collab.yml index 581a8e4c..fa2c62b7 100644 --- a/.github/workflows/collab.yml +++ b/.github/workflows/collab.yml @@ -28,7 +28,7 @@ jobs: - name: Install Build Software shell: bash -l {0} run: | - pip install jupyter-book==0.15.1 docutils==0.17.1 quantecon-book-theme==0.7.1 sphinx-tojupyter==0.3.0 sphinxext-rediraffe==0.2.7 sphinx-exercise==0.4.1 sphinxcontrib-youtube==1.1.0 sphinx-togglebutton==0.3.1 arviz==0.13.0 sphinx_proof==0.1.3 + pip install pandas==2.1.4 jupyter-book==0.15.1 docutils==0.17.1 quantecon-book-theme==0.7.1 sphinx-tojupyter==0.3.0 sphinxext-rediraffe==0.2.7 sphinx-exercise==0.4.1 sphinxcontrib-youtube==1.1.0 sphinx-togglebutton==0.3.1 arviz==0.13.0 sphinx_proof==0.1.3 # Build of HTML (Execution Testing) - name: Build HTML shell: bash -l {0} From cba28247bb09a6253e4458a38f78451754ba04a8 Mon Sep 17 00:00:00 2001 From: mmcky Date: Fri, 10 May 2024 11:59:26 +1000 Subject: [PATCH 11/17] Revert "pin pandas in CI" This reverts commit ef7b3541592bee6b17c5b8fb1643ca4f91480deb. --- .github/workflows/collab.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/collab.yml b/.github/workflows/collab.yml index fa2c62b7..581a8e4c 100644 --- a/.github/workflows/collab.yml +++ b/.github/workflows/collab.yml @@ -28,7 +28,7 @@ jobs: - name: Install Build Software shell: bash -l {0} run: | - pip install pandas==2.1.4 jupyter-book==0.15.1 docutils==0.17.1 quantecon-book-theme==0.7.1 sphinx-tojupyter==0.3.0 sphinxext-rediraffe==0.2.7 sphinx-exercise==0.4.1 sphinxcontrib-youtube==1.1.0 sphinx-togglebutton==0.3.1 arviz==0.13.0 sphinx_proof==0.1.3 + pip install jupyter-book==0.15.1 docutils==0.17.1 quantecon-book-theme==0.7.1 sphinx-tojupyter==0.3.0 sphinxext-rediraffe==0.2.7 sphinx-exercise==0.4.1 sphinxcontrib-youtube==1.1.0 sphinx-togglebutton==0.3.1 arviz==0.13.0 sphinx_proof==0.1.3 # Build of HTML (Execution Testing) - name: Build HTML shell: bash -l {0} From dd599be17e6ece4e17c3584088c47d77820eca49 Mon Sep 17 00:00:00 2001 From: mmcky Date: Fri, 10 May 2024 12:18:06 +1000 Subject: [PATCH 12/17] fetch latest tag --- .github/workflows/collab.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/collab.yml b/.github/workflows/collab.yml index 581a8e4c..f3d61329 100644 --- a/.github/workflows/collab.yml +++ b/.github/workflows/collab.yml @@ -5,7 +5,7 @@ jobs: test: runs-on: ubuntu-latest-m container: - image: docker://us-docker.pkg.dev/colab-images/public/runtime + image: docker://us-docker.pkg.dev/colab-images/public/runtime:latest steps: - uses: actions/checkout@v4 with: From 700220aecd3494d587db3ddf606044a5eac8ca73 Mon Sep 17 00:00:00 2001 From: mmcky Date: Mon, 13 May 2024 16:30:30 +1000 Subject: [PATCH 13/17] check docker env --- .github/workflows/collab.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/collab.yml b/.github/workflows/collab.yml index f3d61329..41e14406 100644 --- a/.github/workflows/collab.yml +++ b/.github/workflows/collab.yml @@ -10,6 +10,8 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha }} + - name: Check for dockerenv file + run: (ls /.dockerenv && echo Found dockerenv) || (echo No dockerenv) - name: Check python version shell: bash -l {0} run: | From e60bad431cf5722c462262d672be47098fe76c6e Mon Sep 17 00:00:00 2001 From: kp992 Date: Tue, 14 May 2024 21:19:31 +0530 Subject: [PATCH 14/17] use some tag --- .github/workflows/collab.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/collab.yml b/.github/workflows/collab.yml index 41e14406..cc9b8c44 100644 --- a/.github/workflows/collab.yml +++ b/.github/workflows/collab.yml @@ -5,7 +5,7 @@ jobs: test: runs-on: ubuntu-latest-m container: - image: docker://us-docker.pkg.dev/colab-images/public/runtime:latest + image: docker://us-docker.pkg.dev/colab-images/public/runtime:release-colab_20240328-060159_RC01 steps: - uses: actions/checkout@v4 with: From e8a7143f174bd8d41a44bce2625cdea881e059af Mon Sep 17 00:00:00 2001 From: kp992 Date: Tue, 14 May 2024 21:42:58 +0530 Subject: [PATCH 15/17] remove tag --- .github/workflows/collab.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/collab.yml b/.github/workflows/collab.yml index cc9b8c44..a785504f 100644 --- a/.github/workflows/collab.yml +++ b/.github/workflows/collab.yml @@ -5,7 +5,7 @@ jobs: test: runs-on: ubuntu-latest-m container: - image: docker://us-docker.pkg.dev/colab-images/public/runtime:release-colab_20240328-060159_RC01 + image: us-docker.pkg.dev/colab-images/public/runtime:latest steps: - uses: actions/checkout@v4 with: From 63d8503779b1ead181f76588ee88ab894943d71f Mon Sep 17 00:00:00 2001 From: kp992 Date: Wed, 15 May 2024 18:37:11 +0530 Subject: [PATCH 16/17] try different approach to check version --- lectures/inflation_history.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lectures/inflation_history.md b/lectures/inflation_history.md index 2834bac8..57da745f 100644 --- a/lectures/inflation_history.md +++ b/lectures/inflation_history.md @@ -28,12 +28,16 @@ This lecture also requires `pandas >= 2.1.4` ```{code-cell} ipython3 :tags: [hide-output] -import pandas +from importlib.metadata import version from packaging.version import Version -from importlib import reload -if Version(pandas.__version__) < Version('2.1.4'): - !pip install pandas==2.1.4 - reload(pandas) + +try: + pandas_version = version("pandas") +except: + pandas_version = '0.0.0' + +if Version(pandas_version) < Version('2.1.4'): + !pip install "pandas>=2.1.4" ``` We can then import the Python modules we will use. From 0a5716baebf945864bc7a57e0192ac6015cc23af Mon Sep 17 00:00:00 2001 From: mmcky Date: Mon, 20 May 2024 12:10:57 +1000 Subject: [PATCH 17/17] hide cell and add comment --- lectures/inflation_history.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lectures/inflation_history.md b/lectures/inflation_history.md index 57da745f..afb36a85 100644 --- a/lectures/inflation_history.md +++ b/lectures/inflation_history.md @@ -24,19 +24,14 @@ The `xlrd` package is used by `pandas` to perform operations on Excel files. !pip install xlrd ``` -This lecture also requires `pandas >= 2.1.4` + ```{code-cell} ipython3 -:tags: [hide-output] +:tags: [hide-cell] from importlib.metadata import version from packaging.version import Version -try: - pandas_version = version("pandas") -except: - pandas_version = '0.0.0' - -if Version(pandas_version) < Version('2.1.4'): +if Version(version("pandas")) < Version('2.1.4'): !pip install "pandas>=2.1.4" ```