Skip to content

Commit

Permalink
initial jb/myst (#199)
Browse files Browse the repository at this point in the history
* initial jb/myst

* update config for jupyter book

* Create deploy.yml

* Update transfer-demark-metadata.yml

---------

Co-authored-by: Mridul Seth <mail@mriduls.com>
  • Loading branch information
alanlujan91 and MridulS committed Apr 19, 2023
1 parent 9bd93fa commit 3e790cc
Show file tree
Hide file tree
Showing 72 changed files with 734 additions and 467 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: deploy-book

# Only run this when the master branch changes
on:
push:
branches:
- master
# If your git repository has the Jupyter Book within some-subfolder next to
# unrelated files, you can make this run only if a file within that specific
# folder has been modified.
#
# paths:
# - some-subfolder/**

# This job installs dependencies, builds the book, and pushes it to `gh-pages`
jobs:
deploy-book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# Install dependencies
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
pip install -r binder/requirements.txt
# Build the book
- name: Build the book
run: |
jupyter-book build .
# Push the book's HTML to github-pages
- name: GitHub Pages action
uses: peaceiris/actions-gh-pages@v3.6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_build/html
22 changes: 11 additions & 11 deletions .github/workflows/transfer-demark-metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ jobs:
copy:
runs-on: ubuntu-latest
steps:
- name: Copycat
uses: andstor/copycat-action@v3
with:
personal_token: ${{ secrets.PERSONAL_TOKEN }}
src_path: notebooks/.
file_filter: '*.md'
dst_path: /_materials/
dst_owner: econ-ark
dst_repo_name: econ-ark.org
dst_branch: master
src_branch: master
- name: Copycat
uses: andstor/copycat-action@v3
with:
personal_token: ${{ secrets.PERSONAL_TOKEN }}
src_path: markdown/.
file_filter: "*.md"
dst_path: /_materials/
dst_owner: econ-ark
dst_repo_name: econ-ark.org
dst_branch: master
src_branch: master
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
.ipynb_checkpoints
notebooks/.ipynb_checkpoints/Gentle-Intro-To-HARK-checkpoint.ipynb
*~
_build
Binary file added PoweredByEconARK.pdf
Binary file not shown.
1 change: 1 addition & 0 deletions PoweredByEconARK.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
93 changes: 93 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
#######################################################################################
# A default configuration that will be loaded for all jupyter books
# Users are expected to override these values in their own `_config.yml` file.
# This is also the "master list" of all allowed keys and values.

#######################################################################################
# Book settings
title: DemARK # The title of the book. Will be placed in the left navbar.
author: The Econ-ARK Team # The author of the book
copyright: "2023" # Copyright year to be placed in the footer
logo: econ-ark-logo.png # A path to the book logo
# Patterns to skip when building the book. Can be glob-style (e.g. "*skip.ipynb")
exclude_patterns: [_build, Thumbs.db, .DS_Store, "**.ipynb_checkpoints"]
# Auto-exclude files not in the toc
only_build_toc_files: false

#######################################################################################
# Execution settings
execute:
execute_notebooks: off # Whether to execute notebooks at build time. Must be one of ("auto", "force", "cache", "off")
cache: "" # A path to the jupyter cache that will be used to store execution artifacts. Defaults to `_build/.jupyter_cache/`
exclude_patterns: [] # A list of patterns to *skip* in execution (e.g. a notebook that takes a really long time)
timeout: 30 # The maximum time (in seconds) each notebook cell is allowed to run.
run_in_temp:
false # If `True`, then a temporary directory will be created and used as the command working directory (cwd),
# otherwise the notebook's parent directory will be the cwd.
allow_errors: false # If `False`, when a code cell raises an error the execution is stopped, otherwise all cells are always run.
stderr_output: show # One of 'show', 'remove', 'remove-warn', 'warn', 'error', 'severe'

#######################################################################################
# Parse and render settings
parse:
myst_enable_extensions: # default extensions to enable in the myst parser. See https://myst-parser.readthedocs.io/en/latest/using/syntax-optional.html
- amsmath
- colon_fence
# - deflist
- dollarmath
# - html_admonition
# - html_image
- linkify
# - replacements
# - smartquotes
- substitution
- tasklist
myst_url_schemes: [mailto, http, https] # URI schemes that will be recognised as external URLs in Markdown links
myst_dmath_double_inline: true # Allow display math ($$) within an inline context

#######################################################################################
# HTML-specific settings
html:
favicon: econ-ark-logo-small.png # A path to a favicon image
use_edit_page_button: false # Whether to add an "edit this page" button to pages. If `true`, repository information in repository: must be filled in
use_repository_button: false # Whether to add a link to your repository button
use_issues_button: false # Whether to add an "open an issue" button
use_multitoc_numbering: true # Continuous numbering across parts/chapters
extra_footer: "" # Will be displayed underneath the footer.
google_analytics_id: "" # A GA id that can be used to track book views.
home_page_in_navbar: true # Whether to include your home page in the left Navigation Bar
baseurl: "" # The base URL where your book will be hosted. Used for creating image previews and social links. e.g.: https://mypage.com/mybook/
analytics:

comments:
hypothesis: false
utterances: false
announcement: "" # A banner announcement at the top of the site.

#######################################################################################
# LaTeX-specific settings
latex:
latex_engine: pdflatex # one of 'pdflatex', 'xelatex' (recommended for unicode), 'luatex', 'platex', 'uplatex'
use_jupyterbook_latex: true # use sphinx-jupyterbook-latex for pdf builds as default

#######################################################################################
# Launch button settings
launch_buttons:
notebook_interface: classic # The interface interactive links will activate ["classic", "jupyterlab"]
binderhub_url: "" # The URL of the BinderHub (e.g., https://mybinder.org)
jupyterhub_url: "" # The URL of the JupyterHub (e.g., https://datahub.berkeley.edu)
thebe: false # Add a thebe button to pages (requires the repository to run on Binder)
colab_url: "" # The URL of Google Colab (https://colab.research.google.com)

repository:
url: https://github.com/econ-ark/DemARK # The URL to your book's repository
path_to_book: notebooks # A path to your book's folder, relative to the repository root.
branch: master # Which branch of the repository should be used when creating links

#######################################################################################
# Advanced and power-user settings
sphinx:
extra_extensions: # A list of extra extensions to load by Sphinx (added to those already used by JB).
local_extensions: # A list of local extensions to load by sphinx specified by "name: path" items
recursive_update: false # A boolean indicating whether to overwrite the Sphinx config (true) or recursively update (false)
config: # key-value pairs to directly over-ride the Sphinx configuration
41 changes: 41 additions & 0 deletions _toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Table of Contents
#
# Myst will respect:
# 1. New pages
# - file: relative/path/to/page
# 2. New sections without an associated page
# - title: Folder Title
# sections: ...
# 3. New sections with an associated page
# - file: relative/path/to/page
# sections: ...
#
# Note: Titles defined on pages here are not recognized.
#
# This spec is based on the JupyterBook table of contents.
# Learn more at https://jupyterbook.org/customize/toc.html

format: jb-book
root: README
chapters:
- file: notebooks/Alternative-Combos-Of-Parameter-Values
- file: notebooks/ChangeLiqConstr
- file: notebooks/Chinese-Growth
- file: notebooks/DCEGM-Upper-Envelope
- file: notebooks/DiamondOLG
- file: notebooks/FisherTwoPeriod
- file: notebooks/Gentle-Intro-To-HARK-Buffer-Stock-Model
- file: notebooks/Gentle-Intro-To-HARK-PerfForesightCRRA
- file: notebooks/Harmenberg-Aggregation
- file: notebooks/IncExpectationExample
- file: notebooks/KeynesFriedmanModigliani
- file: notebooks/LC-Model-Expected-Vs-Realized-Income-Growth
- file: notebooks/LifeCycleModelTheoryVsData
- file: notebooks/Lucas-Asset-Pricing-Model
- file: notebooks/MPC-Out-of-Credit-vs-MPC-Out-of-Income
- file: notebooks/Micro-and-Macro-Implications-of-Very-Impatient-HHs
- file: notebooks/Nondurables-During-Great-Recession
- file: notebooks/PerfForesightCRRA-Approximation
- file: notebooks/PerfForesightCRRA-SavingRate
- file: notebooks/Structural-Estimates-From-Empirical-MPCs-Fagereng-et-al
- file: notebooks/TractableBufferStock-Interactive
Binary file added econ-ark-logo-small.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added econ-ark-logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions myst.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# See docs at: https://myst-tools.org/docs/mystjs/frontmatter
version: 1
project:
# title:
# description:
keywords: []
authors: []
github: https://github.com/alanlujan91/DemARK
# bibliography: []
site:
template: book-theme
# title:
# logo:
projects:
- slug: myst
path: .
nav: []
actions:
- title: Learn More
url: https://myst-tools.org/docs/mystjs
domains: []
18 changes: 8 additions & 10 deletions notebooks/Alternative-Combos-Of-Parameter-Values.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,17 @@
"iopub.status.busy": "2023-01-20T20:49:17.366724Z",
"iopub.status.idle": "2023-01-20T20:49:18.978028Z",
"shell.execute_reply": "2023-01-20T20:49:18.978028Z"
}
},
"lines_to_next_cell": 2
},
"outputs": [],
"source": [
"# This cell merely imports and sets up some basic functions and packages\n",
"\n",
"%matplotlib inline\n",
"from HARK.utilities import get_lorenz_shares, get_percentiles\n",
"import matplotlib.pyplot as plt\n",
"from tqdm import tqdm\n",
"import numpy as np\n",
"from copy import deepcopy\n",
"\n",
"import HARK # Prevents import error from Demos repo\n",
"from HARK.utilities import plot_funcs"
"import numpy as np"
]
},
{
Expand Down Expand Up @@ -268,11 +264,11 @@
"iopub.status.busy": "2023-01-20T20:49:22.362741Z",
"iopub.status.idle": "2023-01-20T20:49:22.375738Z",
"shell.execute_reply": "2023-01-20T20:49:22.375738Z"
}
},
"lines_to_next_cell": 2
},
"outputs": [],
"source": [
"\n",
"# Finish filling in this function to calculate the Euclidean distance between the simulated and actual Lorenz curves.\n",
"\n",
"\n",
Expand Down Expand Up @@ -310,7 +306,9 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"lines_to_next_cell": 2
},
"source": [
"## ...and the Marginal Propensity to Consume\n",
"\n",
Expand Down
6 changes: 1 addition & 5 deletions notebooks/Alternative-Combos-Of-Parameter-Values.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,9 @@

# %matplotlib inline
from HARK.utilities import get_lorenz_shares, get_percentiles
import matplotlib.pyplot as plt
from tqdm import tqdm
import numpy as np
from copy import deepcopy

import HARK # Prevents import error from Demos repo
from HARK.utilities import plot_funcs

# %% {"code_folding": [0, 4]}
# Import IndShockConsumerType
Expand Down Expand Up @@ -180,7 +176,6 @@
# Your next exercise is to show how the distribution of wealth differs for the different parameter values

# %%

# Finish filling in this function to calculate the Euclidean distance between the simulated and actual Lorenz curves.


Expand Down Expand Up @@ -227,6 +222,7 @@ def calcLorenzDistance(SomeTypes):
#
# $\kappa_{Y} \approx 1.0 - (1.0 - \kappa_{Q})^4$


# %%
# Write a function to tell us about the distribution of the MPC in this code block, then test it!
# You will almost surely find it useful to use a for loop in this function.
Expand Down
2 changes: 1 addition & 1 deletion notebooks/ChangeLiqConstr.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"import matplotlib.pyplot as plt\n",
"from copy import deepcopy\n",
"from HARK.ConsumptionSaving.ConsIndShockModel import KinkedRconsumerType\n",
"from HARK.utilities import plot_funcs_der, plot_funcs\n",
"from HARK.utilities import plot_funcs\n",
"\n",
"\n",
"def mystr(number):\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/ChangeLiqConstr.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import matplotlib.pyplot as plt
from copy import deepcopy
from HARK.ConsumptionSaving.ConsIndShockModel import KinkedRconsumerType
from HARK.utilities import plot_funcs_der, plot_funcs
from HARK.utilities import plot_funcs


def mystr(number):
Expand Down

0 comments on commit 3e790cc

Please sign in to comment.