Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add process to automatically update example notebooks #1328

Merged
merged 10 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
64 changes: 64 additions & 0 deletions .github/workflows/execute-notebooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Execute notebooks

# Run on all pushes and pull requests, and on demand
on:
push:
branches:
- master
paths:
- ".github/workflows/execute-notebooks.yml"
- "examples/**"
workflow_dispatch:

# Limit workflow permissions
permissions:
contents: read

# Limit simultaneous workflow runs
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

env:
FORCE_COLOR: "1"

jobs:
execute:
name: Execute
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: "3.10" # Numba doesn't support Python 3.11 [2023-05]
cache: 'pip'
cache-dependency-path: |
requirements/base.txt

- name: Install HARK
run: |
python -m pip install --upgrade pip
python -m pip install .
python -m pip install nbformat nbclient nbstripout

- name: Strip output
run: nbstripout examples/**/*.ipynb

- name: Execute notebooks
run: python tools/nb_exec.py examples/**/*.ipynb

- name: Open PR
uses: peter-evans/create-pull-request@v5
with:
author: "Econ-ARK Bot <noreply@econ-ark.org>"
branch: "bot/update-notebooks"
commit-message: "[bot] updated notebooks"
delete-branch: true
title: "[bot] Execute example notebooks"
body: |
This PR was automatically generated to re-execute
the example notebooks for use in the documentation.
2 changes: 1 addition & 1 deletion Documentation/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@
napoleon_use_ivar = True # solves duplicate object description warning

# nbsphinx configuration
nbsphinx_execute = "never" # This is currently not working
nbsphinx_execute = "never" # notebooks are executed via ``nb_exec.py``
27 changes: 4 additions & 23 deletions examples/Calibration/Income_calibrations.ipynb

Large diffs are not rendered by default.

54 changes: 5 additions & 49 deletions examples/Calibration/Life_Cycle_example.ipynb

Large diffs are not rendered by default.

35 changes: 12 additions & 23 deletions examples/Calibration/SCF_distributions.ipynb

Large diffs are not rendered by default.

23 changes: 5 additions & 18 deletions examples/Calibration/Sabelhaus_Song_var_profiles.ipynb

Large diffs are not rendered by default.

45 changes: 6 additions & 39 deletions examples/Calibration/US_SSA_life_tables.ipynb

Large diffs are not rendered by default.

65 changes: 7 additions & 58 deletions examples/ConsBequestModel/example_AccidentalBequest.ipynb

Large diffs are not rendered by default.

148 changes: 128 additions & 20 deletions examples/ConsBequestModel/example_ConsIndShockComp.ipynb

Large diffs are not rendered by default.

83 changes: 16 additions & 67 deletions examples/ConsBequestModel/example_TerminalBequest.ipynb

Large diffs are not rendered by default.

42 changes: 7 additions & 35 deletions examples/ConsIndShockModel/Finite Cyclical Test.ipynb

Large diffs are not rendered by default.

126 changes: 22 additions & 104 deletions examples/ConsIndShockModel/IndShockConsumerType.ipynb

Large diffs are not rendered by default.

136 changes: 17 additions & 119 deletions examples/ConsIndShockModel/IndShockConsumerType_Jacobian_Example.ipynb

Large diffs are not rendered by default.

Large diffs are not rendered by default.

71 changes: 12 additions & 59 deletions examples/ConsIndShockModel/KinkedRconsumerType.ipynb

Large diffs are not rendered by default.

135 changes: 24 additions & 111 deletions examples/ConsIndShockModel/PerfForesightConsumerType.ipynb

Large diffs are not rendered by default.

224 changes: 46 additions & 178 deletions examples/ConsPortfolioModel/example_ConsPortfolioModel.ipynb

Large diffs are not rendered by default.

217 changes: 28 additions & 189 deletions examples/ConsPortfolioModel/example_ConsRiskyAssetModel.ipynb

Large diffs are not rendered by default.

115 changes: 19 additions & 96 deletions examples/ConsPortfolioModel/example_ConsSequentialPortfolioModel.ipynb

Large diffs are not rendered by default.

138 changes: 34 additions & 104 deletions examples/ConsumptionSaving/example_ConsAggShockModel.ipynb

Large diffs are not rendered by default.

141 changes: 25 additions & 116 deletions examples/ConsumptionSaving/example_ConsGenIncProcessModel.ipynb

Large diffs are not rendered by default.

250 changes: 38 additions & 212 deletions examples/ConsumptionSaving/example_ConsIndShock.ipynb

Large diffs are not rendered by default.

192 changes: 33 additions & 159 deletions examples/ConsumptionSaving/example_ConsLaborModel.ipynb

Large diffs are not rendered by default.

188 changes: 28 additions & 160 deletions examples/ConsumptionSaving/example_ConsMarkovModel.ipynb

Large diffs are not rendered by default.

138 changes: 34 additions & 104 deletions examples/ConsumptionSaving/example_ConsMedModel.ipynb

Large diffs are not rendered by default.

131 changes: 20 additions & 111 deletions examples/ConsumptionSaving/example_ConsPrefShockModel.ipynb

Large diffs are not rendered by default.

66 changes: 12 additions & 54 deletions examples/ConsumptionSaving/example_ConsRepAgentModel.ipynb

Large diffs are not rendered by default.

108 changes: 16 additions & 92 deletions examples/ConsumptionSaving/example_TractableBufferStockModel.ipynb

Large diffs are not rendered by default.

131 changes: 20 additions & 111 deletions examples/Distributions/DiscreteDistributionLabeled.ipynb

Large diffs are not rendered by default.

166 changes: 27 additions & 139 deletions examples/Distributions/ExpectedValue.ipynb

Large diffs are not rendered by default.

1,012 changes: 490 additions & 522 deletions examples/FrameAgentType/FrameAgentType Demo.ipynb

Large diffs are not rendered by default.

278 changes: 37 additions & 241 deletions examples/FrameAgentType/FrameModels.ipynb

Large diffs are not rendered by default.

132 changes: 20 additions & 112 deletions examples/GenIncProcessModel/GenIncProcessModel.ipynb

Large diffs are not rendered by default.

164 changes: 24 additions & 140 deletions examples/Gentle-Intro/Gentle-Intro-To-HARK.ipynb

Large diffs are not rendered by default.

Large diffs are not rendered by default.

60 changes: 9 additions & 51 deletions examples/Interpolation/CubicInterp.ipynb

Large diffs are not rendered by default.

62 changes: 18 additions & 44 deletions examples/Interpolation/DecayInterp.ipynb

Large diffs are not rendered by default.

82 changes: 29 additions & 53 deletions examples/Journeys/AzureMachineLearning.ipynb

Large diffs are not rendered by default.

9 changes: 1 addition & 8 deletions examples/Journeys/Journey-Engineering-Background.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
"version": "3.10.12"
},
"latex_envs": {
"LaTeX_envs_menu_present": true,
Expand Down Expand Up @@ -95,13 +95,6 @@
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"state": {},
"version_major": 2,
"version_minor": 0
}
}
},
"nbformat": 4,
Expand Down
84 changes: 10 additions & 74 deletions examples/Journeys/Journey-PhD.ipynb

Large diffs are not rendered by default.

93 changes: 15 additions & 78 deletions examples/Journeys/Journey-Policymaker.ipynb

Large diffs are not rendered by default.

9 changes: 1 addition & 8 deletions examples/Journeys/Journeys-into-HARK.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"state": {},
"version_major": 2,
"version_minor": 0
}
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
Loading