From 47bb82ac0d90e57cee525a95a3e611715dbea457 Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 13:27:41 +1100 Subject: [PATCH 01/33] updates to github actions for testing --- .github/workflows/ci.yml | 2 +- .github/workflows/publish.yml | 26 +++++++++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b7591f0c..7b5ca291 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,7 @@ name: Build Project [using jupyter-book] on: [push] jobs: - tests: + preview: runs-on: ubuntu-latest steps: - name: Checkout diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 09182942..f711895e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,6 +3,7 @@ on: push: branches: - master + - add-binder jobs: tests: runs-on: ubuntu-latest @@ -34,9 +35,24 @@ jobs: jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter mkdir _build/html/_notebooks cp _build/jupyter/*.ipynb _build/html/_notebooks - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 + # - name: Deploy to gh-pages + # uses: peaceiris/actions-gh-pages@v3 + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # publish_dir: _build/html/ + # cname: python-programming.quantecon.org + - name: Checkout lecture-python-programming.notebooks + uses: actions/checkout@v2 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: _build/html/ - cname: python-programming.quantecon.org \ No newline at end of file + repository: quantecon/lecture-python-programming.notebooks + token: ${{ secrets.QUANTECON_SERVICES }} + - name: Commit latest notebooks to lecture-python-programming.notebooks + run: | + git config --local user.email "admin@quantecon.org" + git config --local user.name "QuantEcon" + pwd + # git commit -m "auto publishing updates to notebooks" + # git push https://$USERNAME:$REPO_KEY@github.com/quantecon/lecture-python-programming.notebooks $GITHUB_REF + env: + REPO_KEY: ${{ secrets.QUANTECON_SERVICES }} + USERNAME: quantecon-services From 0c1ccedeaeeda9698d894d2cbd65f19180aac060 Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 13:37:33 +1100 Subject: [PATCH 02/33] update repository url --- .github/workflows/publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f711895e..e9992202 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,7 +5,7 @@ on: - master - add-binder jobs: - tests: + publish: runs-on: ubuntu-latest steps: - name: Checkout @@ -44,7 +44,7 @@ jobs: - name: Checkout lecture-python-programming.notebooks uses: actions/checkout@v2 with: - repository: quantecon/lecture-python-programming.notebooks + repository: QuantEcon/lecture-python-programming.notebooks token: ${{ secrets.QUANTECON_SERVICES }} - name: Commit latest notebooks to lecture-python-programming.notebooks run: | From 55e0b0179f6b78db121ede3c72f8f5a8ebf3d9d4 Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 14:02:09 +1100 Subject: [PATCH 03/33] see if checkout needs credentials --- .github/workflows/publish.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e9992202..ce7c9d7c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -45,12 +45,16 @@ jobs: uses: actions/checkout@v2 with: repository: QuantEcon/lecture-python-programming.notebooks - token: ${{ secrets.QUANTECON_SERVICES }} + - name: Copy Download Notebooks + shell: bash -l {0} + run: | + pwd + cp ../_build/jupyter/*.ipynb ./ - name: Commit latest notebooks to lecture-python-programming.notebooks run: | git config --local user.email "admin@quantecon.org" git config --local user.name "QuantEcon" - pwd + echo $GITHUB_REF # git commit -m "auto publishing updates to notebooks" # git push https://$USERNAME:$REPO_KEY@github.com/quantecon/lecture-python-programming.notebooks $GITHUB_REF env: From ba031c9522b19e5400d5191e0c5e633265fa2021 Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 14:15:19 +1100 Subject: [PATCH 04/33] new approach --- .github/workflows/publish.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ce7c9d7c..be593fb4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -25,33 +25,33 @@ jobs: - name: Display Pip Versions shell: bash -l {0} run: pip list - - name: Build HTML - shell: bash -l {0} - run: | - jb build lectures --path-output ./ + # - name: Build HTML + # shell: bash -l {0} + # run: | + # jb build lectures --path-output ./ - name: Build Download Notebooks (sphinx-tojupyter) shell: bash -l {0} run: | jb build lectures --path-output ./ --builder=custom --custom-builder=jupyter - mkdir _build/html/_notebooks - cp _build/jupyter/*.ipynb _build/html/_notebooks + # - name: Copy Download Notebooks for GH-PAGES + # shell: bash -l {0} + # run: | + # mkdir _build/html/_notebooks + # cp _build/jupyter/*.ipynb _build/html/_notebooks # - name: Deploy to gh-pages # uses: peaceiris/actions-gh-pages@v3 # with: # github_token: ${{ secrets.GITHUB_TOKEN }} # publish_dir: _build/html/ # cname: python-programming.quantecon.org - - name: Checkout lecture-python-programming.notebooks - uses: actions/checkout@v2 - with: - repository: QuantEcon/lecture-python-programming.notebooks - - name: Copy Download Notebooks - shell: bash -l {0} - run: | - pwd - cp ../_build/jupyter/*.ipynb ./ - name: Commit latest notebooks to lecture-python-programming.notebooks + shell: bash -l {0} run: | + # Fetch + git clone https://github.com/QuantEcon/lecture-python-programming.notebooks + cp _build/jupyter/*.ipynb lecture-python-programming.notebooks/ + # Commit and Save + cd lecture-python-programming.notebooks/ git config --local user.email "admin@quantecon.org" git config --local user.name "QuantEcon" echo $GITHUB_REF From 85f5bfe4fb75ba53563a058801b7e8ff24868d9a Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 14:25:34 +1100 Subject: [PATCH 05/33] test commit to branch add-binder on notebooks repo --- .github/workflows/publish.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index be593fb4..6ad32c05 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -49,14 +49,13 @@ jobs: run: | # Fetch git clone https://github.com/QuantEcon/lecture-python-programming.notebooks - cp _build/jupyter/*.ipynb lecture-python-programming.notebooks/ - # Commit and Save cd lecture-python-programming.notebooks/ + git checkout add-binder + cp ../_build/jupyter/*.ipynb ./ git config --local user.email "admin@quantecon.org" git config --local user.name "QuantEcon" - echo $GITHUB_REF - # git commit -m "auto publishing updates to notebooks" - # git push https://$USERNAME:$REPO_KEY@github.com/quantecon/lecture-python-programming.notebooks $GITHUB_REF + git commit -m "auto publishing updates to notebooks" + git push https://$USERNAME:$REPO_KEY@github.com/quantecon/lecture-python-programming.notebooks add-binder env: REPO_KEY: ${{ secrets.QUANTECON_SERVICES }} USERNAME: quantecon-services From a49cb0d1b61b40fdd198a2227767ae9cabef1290 Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 14:35:19 +1100 Subject: [PATCH 06/33] fix git branch --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6ad32c05..fdd0f978 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -50,7 +50,7 @@ jobs: # Fetch git clone https://github.com/QuantEcon/lecture-python-programming.notebooks cd lecture-python-programming.notebooks/ - git checkout add-binder + git checkout -b add-binder cp ../_build/jupyter/*.ipynb ./ git config --local user.email "admin@quantecon.org" git config --local user.name "QuantEcon" From 22b590dcb19195bfaeb975972a55a2467ad6d4ee Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 14:44:08 +1100 Subject: [PATCH 07/33] fix git commands --- .github/workflows/publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fdd0f978..2a5cbe61 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -54,6 +54,7 @@ jobs: cp ../_build/jupyter/*.ipynb ./ git config --local user.email "admin@quantecon.org" git config --local user.name "QuantEcon" + git add . git commit -m "auto publishing updates to notebooks" git push https://$USERNAME:$REPO_KEY@github.com/quantecon/lecture-python-programming.notebooks add-binder env: From 303105f8d33eb81af97dc38084f20cb97854a1ab Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 14:55:46 +1100 Subject: [PATCH 08/33] fix git link --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2a5cbe61..a9af752f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -56,7 +56,7 @@ jobs: git config --local user.name "QuantEcon" git add . git commit -m "auto publishing updates to notebooks" - git push https://$USERNAME:$REPO_KEY@github.com/quantecon/lecture-python-programming.notebooks add-binder + git push https://$USERNAME:$REPO_KEY@github.com/QuantEcon/lecture-python-programming.notebooks add-binder env: REPO_KEY: ${{ secrets.QUANTECON_SERVICES }} USERNAME: quantecon-services From 143c3d7c4b4f18eba42c48d0d94c30294f3c803e Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 15:07:25 +1100 Subject: [PATCH 09/33] make sure git uses ssh to pull --- .github/workflows/publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a9af752f..eb34d439 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -48,11 +48,11 @@ jobs: shell: bash -l {0} run: | # Fetch - git clone https://github.com/QuantEcon/lecture-python-programming.notebooks + git clone https://$USERNAME:$REPO_KEY@github.com/QuantEcon/lecture-python-programming.notebooks cd lecture-python-programming.notebooks/ git checkout -b add-binder cp ../_build/jupyter/*.ipynb ./ - git config --local user.email "admin@quantecon.org" + git config --local user.email "services@quantecon.org" git config --local user.name "QuantEcon" git add . git commit -m "auto publishing updates to notebooks" From ff41aef17732e5b1ce9ce874af51cc8589f0c814 Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 15:24:03 +1100 Subject: [PATCH 10/33] try using actions/checkout --- .github/workflows/publish.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index eb34d439..a0766daf 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -44,19 +44,22 @@ jobs: # github_token: ${{ secrets.GITHUB_TOKEN }} # publish_dir: _build/html/ # cname: python-programming.quantecon.org + - name: Checkout lecture-python-programming.ntoebooks + uses: actions/checkout@v2 + repository: QuantEcon/lecture-python-programming.notebooks + token: ${{ secrets.QUANTECON_SERVICES }} - name: Commit latest notebooks to lecture-python-programming.notebooks shell: bash -l {0} run: | - # Fetch - git clone https://$USERNAME:$REPO_KEY@github.com/QuantEcon/lecture-python-programming.notebooks - cd lecture-python-programming.notebooks/ - git checkout -b add-binder - cp ../_build/jupyter/*.ipynb ./ - git config --local user.email "services@quantecon.org" - git config --local user.name "QuantEcon" - git add . - git commit -m "auto publishing updates to notebooks" - git push https://$USERNAME:$REPO_KEY@github.com/QuantEcon/lecture-python-programming.notebooks add-binder + pwd + # cd lecture-python-programming.notebooks/ + # git checkout -b add-binder + # cp ../_build/jupyter/*.ipynb ./ + # git config --local user.email "services@quantecon.org" + # git config --local user.name "QuantEcon" + # git add . + # git commit -m "auto publishing updates to notebooks" + # git push https://$USERNAME:$REPO_KEY@github.com/QuantEcon/lecture-python-programming.notebooks add-binder env: REPO_KEY: ${{ secrets.QUANTECON_SERVICES }} USERNAME: quantecon-services From 5b4d2f2b1d201bb2cef091dca212385c05247063 Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 15:25:20 +1100 Subject: [PATCH 11/33] fix --- .github/workflows/publish.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a0766daf..c31dab78 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -46,8 +46,9 @@ jobs: # cname: python-programming.quantecon.org - name: Checkout lecture-python-programming.ntoebooks uses: actions/checkout@v2 - repository: QuantEcon/lecture-python-programming.notebooks - token: ${{ secrets.QUANTECON_SERVICES }} + with: + repository: QuantEcon/lecture-python-programming.notebooks + token: ${{ secrets.QUANTECON_SERVICES }} - name: Commit latest notebooks to lecture-python-programming.notebooks shell: bash -l {0} run: | From bd66473fa86ea105fcdcacb8c6a0c6457cada534 Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 20:08:34 +1100 Subject: [PATCH 12/33] change to use PAT --- .github/workflows/publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c31dab78..bbfef951 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -48,7 +48,7 @@ jobs: uses: actions/checkout@v2 with: repository: QuantEcon/lecture-python-programming.notebooks - token: ${{ secrets.QUANTECON_SERVICES }} + token: ${{ secrets.QUANTECON_SERVICES_PAT }} - name: Commit latest notebooks to lecture-python-programming.notebooks shell: bash -l {0} run: | @@ -62,5 +62,5 @@ jobs: # git commit -m "auto publishing updates to notebooks" # git push https://$USERNAME:$REPO_KEY@github.com/QuantEcon/lecture-python-programming.notebooks add-binder env: - REPO_KEY: ${{ secrets.QUANTECON_SERVICES }} + REPO_KEY: ${{ secrets.QUANTECON_SERVICES_PAT }} USERNAME: quantecon-services From 2cbde907edc5a0f4dea02ac28af0b7d93248af3a Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 20:18:29 +1100 Subject: [PATCH 13/33] add more status --- .github/workflows/publish.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bbfef951..74831137 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -53,7 +53,8 @@ jobs: shell: bash -l {0} run: | pwd - # cd lecture-python-programming.notebooks/ + ls -a + cd lecture-python-programming.notebooks/ # git checkout -b add-binder # cp ../_build/jupyter/*.ipynb ./ # git config --local user.email "services@quantecon.org" From f7ac5fd2466da9a2306553b5623754a55281ad52 Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 20:30:41 +1100 Subject: [PATCH 14/33] check path --- .github/workflows/publish.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 74831137..d1876a29 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -54,7 +54,8 @@ jobs: run: | pwd ls -a - cd lecture-python-programming.notebooks/ + ls -a ../ + cd ../lecture-python-programming.notebooks/ # git checkout -b add-binder # cp ../_build/jupyter/*.ipynb ./ # git config --local user.email "services@quantecon.org" From 629289decbd9016d8d5b986ed117c7ddb11c915b Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 20:40:35 +1100 Subject: [PATCH 15/33] update checkout path --- .github/workflows/publish.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d1876a29..d1c0bc77 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -44,8 +44,9 @@ jobs: # github_token: ${{ secrets.GITHUB_TOKEN }} # publish_dir: _build/html/ # cname: python-programming.quantecon.org - - name: Checkout lecture-python-programming.ntoebooks + - name: Checkout lecture-python-programming.notebooks uses: actions/checkout@v2 + path: ./ with: repository: QuantEcon/lecture-python-programming.notebooks token: ${{ secrets.QUANTECON_SERVICES_PAT }} @@ -54,8 +55,7 @@ jobs: run: | pwd ls -a - ls -a ../ - cd ../lecture-python-programming.notebooks/ + cd lecture-python-programming.notebooks/ # git checkout -b add-binder # cp ../_build/jupyter/*.ipynb ./ # git config --local user.email "services@quantecon.org" From f3870166623b57b9876b2b290659b8d632a7ac04 Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 20:46:11 +1100 Subject: [PATCH 16/33] check path in with --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d1c0bc77..bf4a93a4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -46,9 +46,9 @@ jobs: # cname: python-programming.quantecon.org - name: Checkout lecture-python-programming.notebooks uses: actions/checkout@v2 - path: ./ with: repository: QuantEcon/lecture-python-programming.notebooks + path: ./ token: ${{ secrets.QUANTECON_SERVICES_PAT }} - name: Commit latest notebooks to lecture-python-programming.notebooks shell: bash -l {0} From 0caa23337db4760750e4315d83372da220335324 Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 20:56:46 +1100 Subject: [PATCH 17/33] try PAT --- .github/workflows/publish.yml | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bf4a93a4..046dea63 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -44,25 +44,18 @@ jobs: # github_token: ${{ secrets.GITHUB_TOKEN }} # publish_dir: _build/html/ # cname: python-programming.quantecon.org - - name: Checkout lecture-python-programming.notebooks - uses: actions/checkout@v2 - with: - repository: QuantEcon/lecture-python-programming.notebooks - path: ./ - token: ${{ secrets.QUANTECON_SERVICES_PAT }} - name: Commit latest notebooks to lecture-python-programming.notebooks shell: bash -l {0} run: | - pwd - ls -a + git pull https://$USERNAME:$REPO_KEY@github.com/QuantEcon/lecture-python-programming.notebooks cd lecture-python-programming.notebooks/ - # git checkout -b add-binder - # cp ../_build/jupyter/*.ipynb ./ - # git config --local user.email "services@quantecon.org" - # git config --local user.name "QuantEcon" - # git add . - # git commit -m "auto publishing updates to notebooks" - # git push https://$USERNAME:$REPO_KEY@github.com/QuantEcon/lecture-python-programming.notebooks add-binder + git checkout -b add-binder + cp ../_build/jupyter/*.ipynb ./ + git config --local user.email "services@quantecon.org" + git config --local user.name "QuantEcon" + git add . + git commit -m "auto publishing updates to notebooks" + git push https://$USERNAME:$REPO_KEY@github.com/QuantEcon/lecture-python-programming.notebooks add-binder env: REPO_KEY: ${{ secrets.QUANTECON_SERVICES_PAT }} USERNAME: quantecon-services From 6874256aeaabef7b7ba759f6ffff3c4f93501693 Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 21:08:09 +1100 Subject: [PATCH 18/33] try new path outside of repo --- .github/workflows/publish.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 046dea63..ec6e5f38 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -47,15 +47,16 @@ jobs: - name: Commit latest notebooks to lecture-python-programming.notebooks shell: bash -l {0} run: | - git pull https://$USERNAME:$REPO_KEY@github.com/QuantEcon/lecture-python-programming.notebooks + cd ../ + git pull https://github.com/QuantEcon/lecture-python-programming.notebooks cd lecture-python-programming.notebooks/ git checkout -b add-binder - cp ../_build/jupyter/*.ipynb ./ + cp ../lecture-python-programming.myst/_build/jupyter/*.ipynb ./ git config --local user.email "services@quantecon.org" git config --local user.name "QuantEcon" git add . git commit -m "auto publishing updates to notebooks" git push https://$USERNAME:$REPO_KEY@github.com/QuantEcon/lecture-python-programming.notebooks add-binder env: - REPO_KEY: ${{ secrets.QUANTECON_SERVICES_PAT }} + REPO_KEY: ${{ secrets.QUANTECON_SERVICES }} USERNAME: quantecon-services From 8a6d56e5812cbc0880b0aa33e2b6e5614ffe55c8 Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 21:17:41 +1100 Subject: [PATCH 19/33] update git commands --- .github/workflows/publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ec6e5f38..433252ed 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -48,10 +48,10 @@ jobs: shell: bash -l {0} run: | cd ../ - git pull https://github.com/QuantEcon/lecture-python-programming.notebooks + git clone https://$USERNAME:$REPO_KEY@github.com/QuantEcon/lecture-python-programming.notebooks cd lecture-python-programming.notebooks/ git checkout -b add-binder - cp ../lecture-python-programming.myst/_build/jupyter/*.ipynb ./ + cp ../_build/jupyter/*.ipynb ./ git config --local user.email "services@quantecon.org" git config --local user.name "QuantEcon" git add . From b9b92820766f51198ddc9968d0da32b275332e88 Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 21:31:42 +1100 Subject: [PATCH 20/33] check new link --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 433252ed..e2a12e94 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -48,7 +48,7 @@ jobs: shell: bash -l {0} run: | cd ../ - git clone https://$USERNAME:$REPO_KEY@github.com/QuantEcon/lecture-python-programming.notebooks + git clone https://github.com/QuantEcon/lecture-python-programming.notebooks cd lecture-python-programming.notebooks/ git checkout -b add-binder cp ../_build/jupyter/*.ipynb ./ From 2771ede05ed7a3a918ad1078de5362635fae311b Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 21:40:55 +1100 Subject: [PATCH 21/33] setup cp path --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e2a12e94..7ba8b1d8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -51,7 +51,7 @@ jobs: git clone https://github.com/QuantEcon/lecture-python-programming.notebooks cd lecture-python-programming.notebooks/ git checkout -b add-binder - cp ../_build/jupyter/*.ipynb ./ + cp ../lecture-python-programming.notebooks/_build/jupyter/*.ipynb ./ git config --local user.email "services@quantecon.org" git config --local user.name "QuantEcon" git add . From 2a31ab39b05edc2eb00df9753ec305296d49fca1 Mon Sep 17 00:00:00 2001 From: mmcky Date: Tue, 1 Dec 2020 21:49:38 +1100 Subject: [PATCH 22/33] fix repo link --- .github/workflows/publish.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7ba8b1d8..37fc1b63 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -51,7 +51,8 @@ jobs: git clone https://github.com/QuantEcon/lecture-python-programming.notebooks cd lecture-python-programming.notebooks/ git checkout -b add-binder - cp ../lecture-python-programming.notebooks/_build/jupyter/*.ipynb ./ + ls -a + cp ../lecture-python-programming.myst/_build/jupyter/*.ipynb ./ git config --local user.email "services@quantecon.org" git config --local user.name "QuantEcon" git add . From eeffd7234d5452dd7a6c7da4343cbc57bd31129e Mon Sep 17 00:00:00 2001 From: mmcky Date: Wed, 2 Dec 2020 12:45:40 +1100 Subject: [PATCH 23/33] check if push is causing the issue --- .github/workflows/publish.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 37fc1b63..25cd2a28 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -51,13 +51,12 @@ jobs: git clone https://github.com/QuantEcon/lecture-python-programming.notebooks cd lecture-python-programming.notebooks/ git checkout -b add-binder - ls -a cp ../lecture-python-programming.myst/_build/jupyter/*.ipynb ./ git config --local user.email "services@quantecon.org" git config --local user.name "QuantEcon" git add . git commit -m "auto publishing updates to notebooks" - git push https://$USERNAME:$REPO_KEY@github.com/QuantEcon/lecture-python-programming.notebooks add-binder + # git push https://$USERNAME:$REPO_KEY@github.com/QuantEcon/lecture-python-programming.notebooks add-binder env: REPO_KEY: ${{ secrets.QUANTECON_SERVICES }} USERNAME: quantecon-services From 8cc89bdab5151f7c0fbdff7809b5a55dc8bb087e Mon Sep 17 00:00:00 2001 From: mmcky Date: Wed, 2 Dec 2020 15:14:56 +1100 Subject: [PATCH 24/33] test using marketplace action --- .github/workflows/publish.yml | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 25cd2a28..dc411e78 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -45,18 +45,14 @@ jobs: # publish_dir: _build/html/ # cname: python-programming.quantecon.org - name: Commit latest notebooks to lecture-python-programming.notebooks - shell: bash -l {0} - run: | - cd ../ - git clone https://github.com/QuantEcon/lecture-python-programming.notebooks - cd lecture-python-programming.notebooks/ - git checkout -b add-binder - cp ../lecture-python-programming.myst/_build/jupyter/*.ipynb ./ - git config --local user.email "services@quantecon.org" - git config --local user.name "QuantEcon" - git add . - git commit -m "auto publishing updates to notebooks" - # git push https://$USERNAME:$REPO_KEY@github.com/QuantEcon/lecture-python-programming.notebooks add-binder + uses: cpina/github-action-push-to-another-repository@master env: - REPO_KEY: ${{ secrets.QUANTECON_SERVICES }} - USERNAME: quantecon-services + API_TOKEN_GITHUB: ${{ secrets.QUANTECON_SERVICES_PAT }} + with: + source-directory: '_build/jupyter/' + destination-repository-username: 'QuantEcon' + destination-repository-name: 'lecture-python-programming.notebooks' + target-branch: 'add-binder' + commit-message: 'auto publishing updates to notebooks' + destination-github-username: 'quantecon-services' + user-email: services@quantecon.org From 54841b341e54fdd6af834b33300d4e0438bcf14d Mon Sep 17 00:00:00 2001 From: mmcky Date: Wed, 2 Dec 2020 15:25:09 +1100 Subject: [PATCH 25/33] update branch name for testing --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index dc411e78..e6400800 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -52,7 +52,7 @@ jobs: source-directory: '_build/jupyter/' destination-repository-username: 'QuantEcon' destination-repository-name: 'lecture-python-programming.notebooks' - target-branch: 'add-binder' + target-branch: 'update-notebooks' commit-message: 'auto publishing updates to notebooks' destination-github-username: 'quantecon-services' user-email: services@quantecon.org From 9654da3e0b9b73edfe25d63bb0039919952e3724 Mon Sep 17 00:00:00 2001 From: mmcky Date: Wed, 2 Dec 2020 16:03:43 +1100 Subject: [PATCH 26/33] setup specific files to sync --- .github/workflows/publish.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e6400800..6e3f0a6e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -44,12 +44,17 @@ jobs: # github_token: ${{ secrets.GITHUB_TOKEN }} # publish_dir: _build/html/ # cname: python-programming.quantecon.org + - name: Prepare lecture-python-programming.notebooks sync + shell: bash -l {0} + run: | + mkdir -p _build/lecture-python-programming.notebooks + cp _build/jupyter/*.ipynb _build/lecture-python-programming.notebooks - name: Commit latest notebooks to lecture-python-programming.notebooks uses: cpina/github-action-push-to-another-repository@master env: API_TOKEN_GITHUB: ${{ secrets.QUANTECON_SERVICES_PAT }} with: - source-directory: '_build/jupyter/' + source-directory: '_build/lecture-python-programming.notebooks/' destination-repository-username: 'QuantEcon' destination-repository-name: 'lecture-python-programming.notebooks' target-branch: 'update-notebooks' From 41bd33c1a5add5334611a0d8645b2ae06e1df8da Mon Sep 17 00:00:00 2001 From: mmcky Date: Wed, 2 Dec 2020 16:26:09 +1100 Subject: [PATCH 27/33] preserve README and config for updates in lecture-python-programming.notebooks --- .github/workflows/publish.yml | 1 + .notebook-repo/.binder/environment.yml | 17 +++++++++++++++++ .notebook-repo/README.md | 7 +++++++ 3 files changed, 25 insertions(+) create mode 100644 .notebook-repo/.binder/environment.yml create mode 100644 .notebook-repo/README.md diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6e3f0a6e..e58886c1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -48,6 +48,7 @@ jobs: shell: bash -l {0} run: | mkdir -p _build/lecture-python-programming.notebooks + cp -r .notebook-repo/* _build/lecture-python-programming.notebooks cp _build/jupyter/*.ipynb _build/lecture-python-programming.notebooks - name: Commit latest notebooks to lecture-python-programming.notebooks uses: cpina/github-action-push-to-another-repository@master diff --git a/.notebook-repo/.binder/environment.yml b/.notebook-repo/.binder/environment.yml new file mode 100644 index 00000000..de38000a --- /dev/null +++ b/.notebook-repo/.binder/environment.yml @@ -0,0 +1,17 @@ +name: lecture-python-programming +channels: + - default +dependencies: + - python=3.8 + - anaconda + - pip + - pip: + - git+https://github.com/executablebooks/jupyter-book.git + - sphinxext-rediraffe + - git+https://github.com/executablebooks/sphinx-multitoc-numbering + - git+https://github.com/executablebooks/sphinx-exercise.git + - joblib + - interpolation + - git+https://github.com/QuantEcon/sphinx-tojupyter.git + - git+https://github.com/QuantEcon/quantecon-book-theme.git + diff --git a/.notebook-repo/README.md b/.notebook-repo/README.md new file mode 100644 index 00000000..3bd13ee4 --- /dev/null +++ b/.notebook-repo/README.md @@ -0,0 +1,7 @@ +# lecture-python-programming.notebooks + +[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/QuantEcon/lecture-python-programming.notebooks/master) + +Notebooks for https://python-programming.quantecon.org + +**Note:** This README should be edited [here](https://github.com/quantecon/lecture-python-programming.myst/.binder) From c7409ad79ddfcaea225b2ff2d78e3a749b34bc12 Mon Sep 17 00:00:00 2001 From: mmcky Date: Wed, 2 Dec 2020 16:38:19 +1100 Subject: [PATCH 28/33] refine cp command --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e58886c1..0a1caf5e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -48,7 +48,7 @@ jobs: shell: bash -l {0} run: | mkdir -p _build/lecture-python-programming.notebooks - cp -r .notebook-repo/* _build/lecture-python-programming.notebooks + cp -a .notebook-repo/. _build/lecture-python-programming.notebooks/ cp _build/jupyter/*.ipynb _build/lecture-python-programming.notebooks - name: Commit latest notebooks to lecture-python-programming.notebooks uses: cpina/github-action-push-to-another-repository@master From a175adae8e79f8c11d7a8f7b592e81e190fa7a01 Mon Sep 17 00:00:00 2001 From: mmcky Date: Wed, 2 Dec 2020 19:26:03 +1100 Subject: [PATCH 29/33] list contens of prep folder --- .github/workflows/publish.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0a1caf5e..028ff8b1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -48,8 +48,9 @@ jobs: shell: bash -l {0} run: | mkdir -p _build/lecture-python-programming.notebooks - cp -a .notebook-repo/. _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 latest notebooks to lecture-python-programming.notebooks uses: cpina/github-action-push-to-another-repository@master env: From 53a0af51d3cc446fe859b2d7ee3c119f83fb3ea1 Mon Sep 17 00:00:00 2001 From: mmcky Date: Wed, 2 Dec 2020 19:35:03 +1100 Subject: [PATCH 30/33] issue with . directories for git sync --- .github/workflows/publish.yml | 2 +- {.notebook-repo => _notebook_repo}/.binder/environment.yml | 0 {.notebook-repo => _notebook_repo}/README.md | 0 3 files changed, 1 insertion(+), 1 deletion(-) rename {.notebook-repo => _notebook_repo}/.binder/environment.yml (100%) rename {.notebook-repo => _notebook_repo}/README.md (100%) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 028ff8b1..b1822e9e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -48,7 +48,7 @@ jobs: shell: bash -l {0} run: | mkdir -p _build/lecture-python-programming.notebooks - cp -a .notebook-repo/. _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 latest notebooks to lecture-python-programming.notebooks diff --git a/.notebook-repo/.binder/environment.yml b/_notebook_repo/.binder/environment.yml similarity index 100% rename from .notebook-repo/.binder/environment.yml rename to _notebook_repo/.binder/environment.yml diff --git a/.notebook-repo/README.md b/_notebook_repo/README.md similarity index 100% rename from .notebook-repo/README.md rename to _notebook_repo/README.md From 4a30da5e9e13a2680f7f6b2a84e0101c1035d77d Mon Sep 17 00:00:00 2001 From: mmcky Date: Wed, 2 Dec 2020 19:43:50 +1100 Subject: [PATCH 31/33] fix typo --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index b1822e9e..91864fb6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -48,7 +48,7 @@ jobs: shell: bash -l {0} run: | mkdir -p _build/lecture-python-programming.notebooks - cp -a _notebook-repo/. _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 latest notebooks to lecture-python-programming.notebooks From 99085f007d76fc900c614b6b5e7eed7dcfbfb24c Mon Sep 17 00:00:00 2001 From: mmcky Date: Wed, 2 Dec 2020 19:57:45 +1100 Subject: [PATCH 32/33] move environment to root level --- _notebook_repo/{.binder => }/environment.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename _notebook_repo/{.binder => }/environment.yml (100%) diff --git a/_notebook_repo/.binder/environment.yml b/_notebook_repo/environment.yml similarity index 100% rename from _notebook_repo/.binder/environment.yml rename to _notebook_repo/environment.yml From 52834072c86623365ce6a0dea679ffdd4b4fc315 Mon Sep 17 00:00:00 2001 From: mmcky Date: Thu, 3 Dec 2020 12:12:54 +1100 Subject: [PATCH 33/33] migrate from code-block to literal for compat with sphinx-tojupyter --- lectures/getting_started.md | 10 +++++----- lectures/need_for_speed.md | 2 +- lectures/pandas.md | 4 ++-- lectures/python_advanced_features.md | 10 +++++----- lectures/python_by_example.md | 4 ++-- lectures/python_essentials.md | 8 ++++---- lectures/python_oop.md | 4 ++-- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/lectures/getting_started.md b/lectures/getting_started.md index c83d393b..327f44f0 100644 --- a/lectures/getting_started.md +++ b/lectures/getting_started.md @@ -364,7 +364,7 @@ One library we'll be using is [QuantEcon.py](http://quantecon.org/quantecon-py). You can install [QuantEcon.py](http://quantecon.org/quantecon-py) by starting Jupyter and typing -```{code-block} ipython3 +```ipython3 !conda install quantecon ``` @@ -372,7 +372,7 @@ into a cell. Alternatively, you can type the following into a terminal -```{code-block} bash +```bash conda install quantecon ``` @@ -380,7 +380,7 @@ More instructions can be found on the [library page](http://quantecon.org/quante To upgrade to the latest version, which you should do regularly, use -```{code-block} bash +```bash conda upgrade quantecon ``` @@ -388,7 +388,7 @@ Another library we will be using is [interpolation.py](https://github.com/EconFo This can be installed by typing in Jupyter -```{code-block} ipython3 +```ipython3 !conda install -c conda-forge interpolation ``` @@ -516,7 +516,7 @@ As the 1st task, try For example, if you've installed the command line version, open up a terminal and enter. -```{code-block} bash +```bash git clone https://github.com/QuantEcon/QuantEcon.py ``` diff --git a/lectures/need_for_speed.md b/lectures/need_for_speed.md index 602762b8..e54c4e58 100644 --- a/lectures/need_for_speed.md +++ b/lectures/need_for_speed.md @@ -197,7 +197,7 @@ Compiled languages avoid these overheads with explicit, static types. For example, consider the following C code, which sums the integers from 1 to 10 -```{code-block} c +```c #include int main(void) { diff --git a/lectures/pandas.md b/lectures/pandas.md index baf87644..039d650d 100644 --- a/lectures/pandas.md +++ b/lectures/pandas.md @@ -165,7 +165,7 @@ Let's look at an example that reads data from the CSV file `pandas/data/test_pwt Here's the content of `test_pwt.csv` -```{code-block} none +``` "country","country isocode","year","POP","XRAT","tcgdp","cc","cg" "Argentina","ARG","2000","37335.653","0.9995","295072.21869","75.716805379","5.5788042896" "Australia","AUS","2000","19053.186","1.72483","541804.6521","67.759025993","6.7200975332" @@ -292,7 +292,7 @@ For example, suppose that we are interested in the [unemployment rate](https://r Via FRED, the entire series for the US civilian unemployment rate can be downloaded directly by entering this URL into your browser (note that this requires an internet connection) -```{code-block} none +``` https://research.stlouisfed.org/fred2/series/UNRATE/downloaddata/UNRATE.csv ``` diff --git a/lectures/python_advanced_features.md b/lectures/python_advanced_features.md index ab93552b..c6f8c186 100644 --- a/lectures/python_advanced_features.md +++ b/lectures/python_advanced_features.md @@ -142,7 +142,7 @@ All iterators can be placed to the right of the `in` keyword in `for` loop state In fact this is how the `for` loop works: If we write -```{code-block} python3 +```python3 for x in iterator: ``` @@ -155,7 +155,7 @@ then the interpreter So now you know how this magical looking syntax works -```{code-block} python3 +```python3 f = open('somefile.txt', 'r') for line in f: # do something @@ -526,7 +526,7 @@ We are now working in the module `__main__`, and hence the namespace for `__main Next, we import a module called `amodule` -```{code-block} python3 +```python3 import amodule ``` @@ -1660,7 +1660,7 @@ Write a function to recursively compute the $t$-th Fibonacci number for any $t$. Complete the following code, and test it using [this csv file](https://raw.githubusercontent.com/QuantEcon/lecture-python-programming/master/source/_static/lecture_specific/python_advanced_features/test_table.csv), which we assume that you've put in your current working directory -```{code-block} python3 +```python3 def column_iterator(target_file, column_number): """A generator function for CSV files. When called with a file name target_file (string) and column number @@ -1680,7 +1680,7 @@ for date in dates: Suppose we have a text file `numbers.txt` containing the following lines -```{code-block} none +``` prices 3 8 diff --git a/lectures/python_by_example.md b/lectures/python_by_example.md index 44958ef5..7c586cd4 100644 --- a/lectures/python_by_example.md +++ b/lectures/python_by_example.md @@ -144,7 +144,7 @@ easily enough if you look around. On this machine, it's located in -```{code-block} ipython +```ipython anaconda3/lib/python3.7/site-packages/numpy ``` @@ -333,7 +333,7 @@ for animal in animals: This example helps to clarify how the `for` loop works: When we execute a loop of the form -```{code-block} python3 +```python3 for variable_name in sequence: ``` diff --git a/lectures/python_essentials.md b/lectures/python_essentials.md index 954e59d8..40ebb06e 100644 --- a/lectures/python_essentials.md +++ b/lectures/python_essentials.md @@ -314,7 +314,7 @@ Note that if `newfile.txt` is not in the present working directory then this cal In this case, you can shift the file to the pwd or specify the [full path](https://en.wikipedia.org/wiki/Path_%28computing%29) to the file -```{code-block} python3 +```python3 f = open('insert_full_path_to_file/newfile.txt', 'r') ``` @@ -620,7 +620,7 @@ After running this code, the docstring is available f? ``` -```{code-block} ipython +```ipython Type: function String Form: File: /home/john/temp/temp.py @@ -632,7 +632,7 @@ Docstring: This function squares its argument f?? ``` -```{code-block} ipython +```ipython Type: function String Form: File: /home/john/temp/temp.py @@ -692,7 +692,7 @@ Here the function created by `lambda` is said to be *anonymous* because it was n In a {ref}`previous lecture `, you came across the statement -```{code-block} python3 +```python3 plt.plot(x, 'b-', label="white noise") ``` diff --git a/lectures/python_oop.md b/lectures/python_oop.md index 3c0a778c..e67dd55d 100644 --- a/lectures/python_oop.md +++ b/lectures/python_oop.md @@ -776,7 +776,7 @@ Implement $F_n$ as a class called `ECDF`, where Your code should work as follows (modulo randomness) -```{code-block} python3 +```python3 from random import uniform samples = [uniform(0, 1) for i in range(10)] @@ -784,7 +784,7 @@ F = ECDF(samples) F(0.5) # Evaluate ecdf at x = 0.5 ``` -```{code-block} python3 +```python3 F.observations = [uniform(0, 1) for i in range(1000)] F(0.5) ```