Skip to content

Commit

Permalink
dynamic dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
alanlujan91 committed Nov 19, 2024
1 parent d673eec commit 67a048f
Show file tree
Hide file tree
Showing 12 changed files with 108 additions and 145 deletions.
26 changes: 9 additions & 17 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,7 @@ jobs:

- name: Run Sphinx
run: >
sphinx-build
-M html . HARK-docs
-T
-c docs
-W
-j 1
sphinx-build -M html . HARK-docs -T -c docs -W -j 1
- name: Set up git for deployment
run: |
Expand All @@ -69,12 +64,13 @@ jobs:
- 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')
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
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
Expand All @@ -91,9 +87,5 @@ jobs:
python -m pip install --upgrade sphinx-lint
- name: Lint documentation with sphinx-lint
run: >
sphinx-lint
--ignore docs/example_notebooks/GenIncProcessModel.py
--enable all
--max-line-length 85
README.md
docs/
sphinx-lint --ignore docs/example_notebooks/GenIncProcessModel.py
--enable all --max-line-length 85 README.md docs/
7 changes: 4 additions & 3 deletions .github/workflows/execute-notebooks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ jobs:
title: "[bot] Execute example notebooks"
# language=Markdown
body: >
This PR was [automatically generated] to re-execute
the example notebooks for use in the documentation.
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
[automatically generated]:
https://github.com/Econ-ARK/HARK/actions/workflows/execute-notebooks.yml
32 changes: 16 additions & 16 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ repos:
rev: "v3.3.3"
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json]
types_or: [yaml, html, css, scss, javascript, json]
args: [--prose-wrap=always]

- repo: https://github.com/astral-sh/ruff-pre-commit
Expand All @@ -59,23 +59,23 @@ repos:
# additional_dependencies:
# - pytest

- repo: https://github.com/codespell-project/codespell
rev: "v2.3.0"
hooks:
- id: codespell
# - repo: https://github.com/codespell-project/codespell
# rev: "v2.3.0"
# hooks:
# - id: codespell

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "v0.10.0.1"
hooks:
- id: shellcheck
# - repo: https://github.com/shellcheck-py/shellcheck-py
# rev: "v0.10.0.1"
# hooks:
# - id: shellcheck

- repo: local
hooks:
- id: disallow-caps
name: Disallow improper capitalization
language: pygrep
entry: PyBind|Numpy|Cmake|CCache|Github|PyTest
exclude: .pre-commit-config.yaml
# - repo: local
# hooks:
# - id: disallow-caps
# name: Disallow improper capitalization
# language: pygrep
# entry: PyBind|Numpy|Cmake|CCache|Github|PyTest
# exclude: .pre-commit-config.yaml

- repo: https://github.com/abravalheri/validate-pyproject
rev: "v0.19"
Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/NARK/Resources/texmf-local/tex/latex/printvrb.sty
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@ no fragment {\tt ==> #1 <==} maybe run LaTeX on source file again?)\vskip12pt\el
\ifnamesinmargin
\vskip1sp\noindent\llap{\vtop to 0pt{\hbox{\tt #1\hskip4pt==>\ }\vss}}\fi%
\csname #1\endcsname\fi
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@ no fragment {\tt ==> #1 <==} maybe run LaTeX on source file again?)\vskip12pt\el
\ifnamesinmargin
\vskip1sp\noindent\llap{\vtop to 0pt{\hbox{\tt #1\hskip4pt==>\ }\vss}}\fi%
\csname #1\endcsname\fi
}
}
2 changes: 1 addition & 1 deletion docs/NARK/texmf-local/tex/latex/articleNoRefHead.cls

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/texmf-local/tex/latex/articleNoRefHead.cls

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/texmf-local/tex/latex/printvrb.sty
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,4 @@ no fragment {\tt ==> #1 <==} maybe run LaTeX on source file again?)\vskip12pt\el
\ifnamesinmargin
\vskip1sp\noindent\llap{\vtop to 0pt{\hbox{\tt #1\hskip4pt==>\ }\vss}}\fi%
\csname #1\endcsname\fi
}
}
104 changes: 37 additions & 67 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
[build-system]
requires = ["hatchling", "hatch-vcs"]
requires = ["hatchling", "hatch-vcs", "hatch-requirements-txt"]
build-backend = "hatchling.build"


[project]
name = "HARK"
authors = [
{ name = "Econ-ARK Team", email = "[email protected]" },
]
authors = [{ name = "Econ-ARK Team", email = "[email protected]" }]
description = "Heterogeneous Agents Resources and toolKit"
keywords = ["economics", "modelling", "modeling", "heterogeneity"]
readme = "README.md"
Expand All @@ -34,36 +32,15 @@ classifiers = [
"Topic :: Other/Nonlisted Topic",
"Typing :: Typed",
]
dynamic = ["version"]
dependencies = []
dynamic = ["version", "dependencies", "optional-dependencies"]

[project.optional-dependencies]
test = [
"pytest >=6",
"pytest-cov >=3",
]
dev = [
"pytest >=6",
"pytest-cov >=3",
]
docs = [
"sphinx>=7.0",
"myst_parser>=0.13",
"sphinx_copybutton",
"sphinx_autodoc_typehints",
"furo>=2023.08.17",
# extension requirements
"ipython", # for the Pygments lexer
"myst-parser>=2",
"nbsphinx>=0.8",
# theme requirements
"pydata-sphinx-theme",
"sphinx>=6.1",
"sphinx-copybutton",
"sphinx-design",
"numpy",
"pandas"
]
[tool.hatch.metadata.hooks.requirements_txt]
files = ["requirements/base.txt"]

[tool.hatch.metadata.hooks.requirements_txt.optional-dependencies]
docs = ["requirements/doc.txt"]
test = ["requirements/dev.txt"]
dev = ["requirements/dev.txt"]

[project.urls]
Homepage = "https://github.com/econ-ark/HARK"
Expand All @@ -86,21 +63,14 @@ scripts.test = "pytest {args}"
minversion = "6.0"
addopts = ["-ra", "--showlocals", "--strict-markers", "--strict-config"]
xfail_strict = true
filterwarnings = [
"error",
]
filterwarnings = ["error"]
log_cli_level = "INFO"
testpaths = [
"tests",
]
testpaths = ["tests"]


[tool.coverage]
run.source = ["HARK"]
report.exclude_also = [
'\.\.\.',
'if typing.TYPE_CHECKING:',
]
report.exclude_also = ['\.\.\.', 'if typing.TYPE_CHECKING:']

[tool.mypy]
files = ["src", "tests"]
Expand All @@ -122,32 +92,32 @@ disallow_incomplete_defs = true

[tool.ruff.lint]
extend-select = [
"B", # flake8-bugbear
"I", # isort
"ARG", # flake8-unused-arguments
"C4", # flake8-comprehensions
"EM", # flake8-errmsg
"ICN", # flake8-import-conventions
"G", # flake8-logging-format
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"RET", # flake8-return
"RUF", # Ruff-specific
"SIM", # flake8-simplify
"T20", # flake8-print
"UP", # pyupgrade
"YTT", # flake8-2020
"EXE", # flake8-executable
"NPY", # NumPy specific rules
"PD", # pandas-vet
"B", # flake8-bugbear
"I", # isort
"ARG", # flake8-unused-arguments
"C4", # flake8-comprehensions
"EM", # flake8-errmsg
"ICN", # flake8-import-conventions
"G", # flake8-logging-format
"PGH", # pygrep-hooks
"PIE", # flake8-pie
"PL", # pylint
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"RET", # flake8-return
"RUF", # Ruff-specific
"SIM", # flake8-simplify
"T20", # flake8-print
"UP", # pyupgrade
"YTT", # flake8-2020
"EXE", # flake8-executable
"NPY", # NumPy specific rules
"PD", # pandas-vet
]
ignore = [
"PLR09", # Too many <...>
"PLR2004", # Magic value used in comparison
"ISC001", # Conflicts with formatter
"PLR09", # Too many <...>
"PLR2004", # Magic value used in comparison
"ISC001", # Conflicts with formatter
]
isort.required-imports = ["from __future__ import annotations"]
# Uncomment if using a _compat.typing backport
Expand Down
70 changes: 35 additions & 35 deletions src/HARK/models/consumer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,41 @@
#

calibration:
DiscFac: 0.96
CRRA: 2.0
R: 1.03 # can be overriden by portfolio dynamics
Rfree: 1.03
EqP: 0.02
LivPrb: 0.98
PermGroFac: 1.01
BoroCnstArt: None
TranShkStd: 0.1
RiskyStd: 0.1
DiscFac: 0.96
CRRA: 2.0
R: 1.03 # can be overriden by portfolio dynamics
Rfree: 1.03
EqP: 0.02
LivPrb: 0.98
PermGroFac: 1.01
BoroCnstArt: None
TranShkStd: 0.1
RiskyStd: 0.1

blocks:
- &cons_normalized
name: consumption normalized
shocks:
live: !Bernoulli
p: LivPrb
theta: !MeanOneLogNormal
sigma: TranShkStd
dynamics:
b: k * R / PermGroFac
m: b + theta
c: !Control
info: m
a: m - c
- &cons_normalized
name: consumption normalized
shocks:
live: !Bernoulli
p: LivPrb
theta: !MeanOneLogNormal
sigma: TranShkStd
dynamics:
b: k * R / PermGroFac
m: b + theta
c: !Control
info: m
a: m - c

reward:
u: c ** (1 - CRRA) / (1 - CRRA)
- &portfolio_choice
name: portfolio choice
shocks:
risky_return: !Lognormal
mean: Rfree + EqP
std: RiskyStd
dynamics:
stigma: !Control
info: a
R: Rfree + (risky_return - Rfree) * stigma
reward:
u: c ** (1 - CRRA) / (1 - CRRA)
- &portfolio_choice
name: portfolio choice
shocks:
risky_return: !Lognormal
mean: Rfree + EqP
std: RiskyStd
dynamics:
stigma: !Control
info: a
R: Rfree + (risky_return - Rfree) * stigma

0 comments on commit 67a048f

Please sign in to comment.