Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into pr/1355
Browse files Browse the repository at this point in the history
  • Loading branch information
alanlujan91 committed Dec 9, 2023
2 parents 6ca7025 + 1ad4731 commit 3cb75ca
Show file tree
Hide file tree
Showing 61 changed files with 3,321 additions and 931 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/chatops-binder.yaml

This file was deleted.

130 changes: 65 additions & 65 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,73 +26,73 @@ jobs:
contents: write

steps:
- uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10" # Interpolation.py doesn't support Python 3.11 [2023-07]
cache: 'pip'
cache-dependency-path: |
requirements/base.txt
requirements/doc.txt
- name: Install Pandoc
run: sudo apt-get install --yes pandoc

- name: Update pip
run: python -m pip install --upgrade pip

- name: Install HARK
run: python -m pip install .[doc]

- name: Run Sphinx
run: >
sphinx-build
-M html Documentation HARK-docs
-T
-W
-j auto
- name: Set up git for deployment
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git config --local --unset-all http.https://github.com/.extraheader
- name: Commit all rendered HTML files
run: |
git switch --orphan gh-pages
git add --all HARK-docs/html
git commit -qm "Documentation from @ ${{ github.repository }}@${{ github.sha }}"
- name: Deploy to GitHub Pages
# Only deploy to Pages on pushes to HEAD
if: (github.repository_owner == 'Econ-ARK') && (github.event_name == 'push') && (github.ref_name == 'master')
run: >
git push
--force
https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}
`git subtree split --prefix HARK-docs/html gh-pages`:refs/heads/gh-pages
- uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10" # Interpolation.py doesn't support Python 3.11 [2023-07]
cache: "pip"
cache-dependency-path: |
requirements/base.txt
requirements/doc.txt
- name: Install Pandoc
run: sudo apt-get install --yes pandoc

- name: Update pip
run: python -m pip install --upgrade pip

- name: Install HARK
run: python -m pip install .[doc]

- name: Run Sphinx
run: >
sphinx-build
-M html Documentation HARK-docs
-T
-W
-j auto
- name: Set up git for deployment
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git config --local --unset-all http.https://github.com/.extraheader
- name: Commit all rendered HTML files
run: |
git switch --orphan gh-pages
git add --all HARK-docs/html
git commit -qm "Documentation from @ ${{ github.repository }}@${{ github.sha }}"
- name: Deploy to GitHub Pages
# Only deploy to Pages on pushes to HEAD
if: (github.repository_owner == 'Econ-ARK') && (github.event_name == 'push') && (github.ref_name == 'master')
run: >
git push
--force
https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}
`git subtree split --prefix HARK-docs/html gh-pages`:refs/heads/gh-pages
lint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade sphinx-lint
- name: Lint documentation with sphinx-lint
run: >
sphinx-lint
--ignore Documentation/example_notebooks/GenIncProcessModel.py
--enable all
--max-line-length 85
README.md
Documentation/
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade sphinx-lint
- name: Lint documentation with sphinx-lint
run: >
sphinx-lint
--ignore Documentation/example_notebooks/GenIncProcessModel.py
--enable all
--max-line-length 85
README.md
Documentation/
82 changes: 41 additions & 41 deletions .github/workflows/execute-notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
workflow_dispatch:
# 6.49 am (GMT) every Monday; time chosen at random
schedule:
- cron: "49 6 * * MON"
- cron: "49 6 * * MON"

# Limit workflow permissions
permissions:
Expand All @@ -29,47 +29,47 @@ jobs:
pull-requests: write

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
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
.github/workflows/execute-notebooks.yml
- uses: actions/checkout@v3
- name: Set up Python 3.10
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
.github/workflows/execute-notebooks.yml
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .
# For LabeledModels.ipynb
python -m pip install estimagic
# For nbstripout
python -m pip install nbstripout
# For nb_exec.py
python -m pip install ipykernel nbclient nbformat
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .
# For LabeledModels.ipynb
python -m pip install estimagic
# For nbstripout
python -m pip install nbstripout
# For nb_exec.py
python -m pip install ipykernel nbclient nbformat
- name: Strip output
run: nbstripout examples/**/*.ipynb
- name: Strip output
run: nbstripout examples/**/*.ipynb

# This step takes c. 20 minutes
- name: Execute notebooks
run: python tools/nb_exec.py examples/**/*.ipynb
env:
PYTHONUNBUFFERED: "1"
# This step takes c. 20 minutes
- name: Execute notebooks
run: python tools/nb_exec.py examples/**/*.ipynb
env:
PYTHONUNBUFFERED: "1"

- name: Open PR
uses: peter-evans/create-pull-request@v5
with:
author: "Econ-ARK Bot <[email protected]>"
branch: "bot/update-notebooks"
commit-message: "[bot] updated notebooks"
delete-branch: true
title: "[bot] Execute example notebooks"
# language=Markdown
body: >
This PR was [automatically generated] to re-execute
the example notebooks for use in the documentation.
[automatically generated]: https://github.com/Econ-ARK/HARK/actions/workflows/execute-notebooks.yml
- name: Open PR
uses: peter-evans/create-pull-request@v5
with:
author: "Econ-ARK Bot <[email protected]>"
branch: "bot/update-notebooks"
commit-message: "[bot] updated notebooks"
delete-branch: true
title: "[bot] Execute example notebooks"
# language=Markdown
body: >
This PR was [automatically generated] to re-execute
the example notebooks for use in the documentation.
[automatically generated]: https://github.com/Econ-ARK/HARK/actions/workflows/execute-notebooks.yml
27 changes: 27 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: pre-commit

on: [push, pull_request]

jobs:
format:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install packages
run: |
python -m pip install --upgrade pip
python -m pip install ".[dev]"
pip list
- name: Lint
run: pre-commit run --all-files --show-diff-on-failure --color always
13 changes: 7 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
exclude: Documentation/example_notebooks/

repos:
- repo: https://github.com/mwouts/jupytext
rev: v1.15.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.4
hooks:
- id: jupytext
args: [--sync, --set-formats, "ipynb", --pipe, black, --execute]
additional_dependencies: [jupytext, black, nbconvert]
files: ^examples/.*\.ipynb$
- id: ruff
types_or: [jupyter]
- id: ruff-format
args: [--check]
types_or: [jupyter]

- repo: https://github.com/psf/black
rev: 23.7.0
Expand Down
3 changes: 3 additions & 0 deletions Documentation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Release Date: TBD

- Adds `HARK.core.AgentPopulation` class to represent a population of agents with ex-ante heterogeneous parametrizations as distributions. [#1237](https://github.com/econ-ark/HARK/pull/1237)
- Adds `HARK.core.Parameters` class to represent a collection of time varying and time invariant parameters in a model. [#1240](https://github.com/econ-ark/HARK/pull/1240)
- Adds `HARK.simulation.monte_carlo` module for generic Monte Carlo simulation functions using Python model configurations. [1296](https://github.com/econ-ark/HARK/pull/1296)

### Minor Changes

Expand All @@ -26,6 +27,8 @@ Release Date: TBD
- Fixes bug that prevented risky-asset consumer types from working with time-varying interest rates `Rfree`. [1343](https://github.com/econ-ark/HARK/pull/1343)
- Overhauls and expands condition checking for the ConsIndShock model [#1294](https://github.com/econ-ark/HARK/pull/1294). Condition values and a description of their interpretation is stored in the bilt dictionary of IndShockConsumerType.
- Creates a `models/` directory with Python model configurations for perfect foresight and Fisher 2-period models. [1347](https://github.com/econ-ark/HARK/pull/1347)
- Fixes bug in AgentType simulations where 'who_dies' for period t was being recorded in period t-1in the history Carlo simulation functions using Python model configurations.[1296](https://github.com/econ-ark/HARK/pull/1296)
- Removes unused `simulation.py` .[1296](https://github.com/econ-ark/HARK/pull/1296)

### 0.13.0

Expand Down
2 changes: 1 addition & 1 deletion Documentation/_static/override-nbsphinx-gallery.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.nbsphinx-gallery {
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
20 changes: 11 additions & 9 deletions Documentation/conf.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
from datetime import date
import warnings
from datetime import date

try:
import numba
except ImportError:
pass
else:
warnings.filterwarnings("ignore",
message="numba.generated_jit.*",
category=numba.NumbaDeprecationWarning)
warnings.filterwarnings("ignore",
message=".* 'nopython' .*",
category=numba.NumbaDeprecationWarning)
warnings.filterwarnings(
"ignore",
message="numba.generated_jit.*",
category=numba.NumbaDeprecationWarning,
)
warnings.filterwarnings(
"ignore", message=".* 'nopython' .*", category=numba.NumbaDeprecationWarning
)

# Project information
project = "HARK"
Expand Down Expand Up @@ -64,7 +66,7 @@
html_theme = "pydata_sphinx_theme"
html_static_path = ["_static"]
html_css_files = [
'override-nbsphinx-gallery.css',
"override-nbsphinx-gallery.css",
]

html_theme_options = {
Expand Down Expand Up @@ -95,7 +97,7 @@
"type": "local",
"attributes": {"target": "_blank"},
},
]
],
}

# Point to Econ-ARK repo for edit buttons
Expand Down
Loading

0 comments on commit 3cb75ca

Please sign in to comment.