Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ releases are available on [Anaconda.org](https://anaconda.org/conda-forge/gettsi

## Unpublished

- {gh}`1057` Use fail/warn mechanism for TT DAG elements ({ghuser}`hmgaudecker`)

- {gh}`1056` Updates to plotting functions ({ghuser}`MImmesberger`)

- {gh}`1054` DOC: Simple example and comprehensive how-to notebook
Expand Down
339 changes: 171 additions & 168 deletions pixi.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ toml = "*"
# --------------------------------------------------------------------------------------

[tool.pixi.pypi-dependencies]
ttsim-backend = { git = "https://github.com/ttsim-dev/ttsim.git", branch = "main" }
ttsim-backend = { git = "https://github.com/ttsim-dev/ttsim.git", branch = "add-fail-warn-mechanism-to-column-objects-param-functions" }
gettsim = {path = ".", editable = true}
jaxtyping = ">=0.3.2"
kaleido = ">=1.0.0"
Expand Down
22 changes: 22 additions & 0 deletions src/_gettsim/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
from __future__ import annotations

WARNING_MSG_FOR_GETTSIM_BG_ID_WTHH_ID_ETC = """
You requested (at least one of)

- `bg_id`
- `wthh_id`
- `vorrangprüfungen__wohngeld_kinderzuschlag_vorrangig_oder_günstiger`

from GETTSIM directly. Results will be correct only if there is exactly one
Familiengemeinschaft in one household and the Familiengemeinschaft coincides with the
Bedarfsgemeinschaft and the wohngeldrechtlicher Teilhaushalt.

If you plan to use more complex household and family structures (e.g. multiple families
within a household, households consisting of more than one generation -- with the
exception of parents and their children if they do not count as adults --, or families
with children who have enough income to fend for themselves, you can compute these IDs
by following the instructions in this repo:

https://github.com/ttsim-dev/gettsim-crazy-grouping-rules

You can then pass the IDs obtained from there as input data to your main GETTSIM call.
"""
3 changes: 2 additions & 1 deletion src/_gettsim/einkommensteuer/einkommensteuer.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,10 @@ def kinderfreibetrag_günstiger_sn(
direction="down",
reference="§ 32a Abs. 1 S.6 EStG",
),
fail_msg_if_included="Tax system before 2002 is not implemented yet.",
)
def betrag_mit_kinderfreibetrag_y_sn_bis_2001() -> float:
raise NotImplementedError("Tax system before 2002 is not implemented yet.")
pass


@policy_function(
Expand Down
3 changes: 2 additions & 1 deletion src/_gettsim/elterngeld/elterngeld.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ def basisbetrag_m(
end_date="2010-12-31",
leaf_name="betrag_m",
rounding_spec=RoundingSpec(base=0.01, direction="down"),
fail_msg_if_included="Elterngeld is not implemented prior to 2011.",
)
def elterngeld_not_implemented() -> float:
raise NotImplementedError("Elterngeld is not implemented prior to 2011.")
pass


@policy_function(start_date="2007-01-01")
Expand Down
11 changes: 4 additions & 7 deletions src/_gettsim/erziehungsgeld/erziehungsgeld.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,11 @@ def betrag_m(
end_date="2003-12-31",
leaf_name="anspruchshöhe_kind_m",
rounding_spec=RoundingSpec(base=0.01, direction="nearest"),
fail_msg_if_included="""Erziehungsgeld is not implemented yet prior to 2004, see
https://github.com/ttsim-dev/gettsim/issues/673""",
)
def erziehungsgeld_kind_ohne_budgetsatz_m() -> NotImplementedError:
raise NotImplementedError(
"""
Erziehungsgeld is not implemented yet prior to 2004, see
https://github.com/ttsim-dev/gettsim/issues/673
""",
)
def anspruchshöhe_kind_ohne_budgetsatz_m() -> float:
pass


@policy_function(
Expand Down
5 changes: 3 additions & 2 deletions src/_gettsim/ids.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from typing import TYPE_CHECKING

from _gettsim import WARNING_MSG_FOR_GETTSIM_BG_ID_WTHH_ID_ETC
from gettsim.tt import group_creation_function, policy_input

if TYPE_CHECKING:
Expand Down Expand Up @@ -136,7 +137,7 @@ def _assign_parents_fg_id(
)


@group_creation_function()
@group_creation_function(warn_msg_if_included=WARNING_MSG_FOR_GETTSIM_BG_ID_WTHH_ID_ETC)
def bg_id(
fg_id: IntColumn,
# xnp is needed to instantiate the GroupCreationFunction (because of `reorder_ids`)
Expand Down Expand Up @@ -182,7 +183,7 @@ def eg_id(
)


@group_creation_function()
@group_creation_function(warn_msg_if_included=WARNING_MSG_FOR_GETTSIM_BG_ID_WTHH_ID_ETC)
def wthh_id(
fg_id: IntColumn,
xnp: ModuleType, # noqa: ARG001
Expand Down
5 changes: 3 additions & 2 deletions src/_gettsim/kindergeld/kindergeld.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ def betrag_gestaffelt_m(
@policy_function(
end_date="1995-12-31",
leaf_name="ist_leistungsbegründendes_kind",
fail_msg_if_included="Kindergeld eligibility is not implemented prior to 1996.",
)
def leistungsbegründendes_kind_nach_lohn_not_implemented() -> NotImplementedError:
raise NotImplementedError("Kindergeld eligibility is not implemented.")
def leistungsbegründendes_kind_nach_lohn_bis_1995() -> bool:
pass


@policy_function(
Expand Down
3 changes: 2 additions & 1 deletion src/_gettsim/lohnsteuer/einkommen.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ def vorsorgepauschale_y_ab_2023(
start_date="2005-01-01",
end_date="2009-12-31",
leaf_name="vorsorgepauschale_y",
fail_msg_if_included="Vorsorgepauschale not implemented before 2010.",
)
def vorsorgepauschale_y_ab_2005_bis_2009() -> float:
raise NotImplementedError("Vorsorgepauschale not implemented before 2010.")
pass
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@
)


@policy_function(end_date="1998-07-31", leaf_name="betrag_m")
def betrag_m_not_implemented() -> float:
@policy_function(
end_date="1998-07-31",
leaf_name="betrag_m",
fail_msg_if_included="Arbeitslosengeld before August 1998 is not implemented.",
)
def betrag_m_bis_1998_07() -> float:
"""Calculate individual unemployment benefit."""
raise NotImplementedError("Arbeitslosengeld before August 1998 is not implemented.")


@policy_function(start_date="1998-08-01")
Expand Down
9 changes: 3 additions & 6 deletions src/_gettsim/unterhaltsvorschuss/unterhaltsvorschuss.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,10 @@ def elternteil_alleinerziehend(
direction="down",
reference="§ 9 Abs. 3 UhVorschG",
),
fail_msg_if_included="Unterhaltsvorschuss is not implemented prior to 2009.",
)
def not_implemented_m() -> float:
raise NotImplementedError(
"""
Unterhaltsvorschuss is not implemented prior to 2009.
""",
)
def betrag_m_bis_2008() -> float:
pass


@param_function(start_date="2023-01-01", leaf_name="kindergeld_erstes_kind_m")
Expand Down
3 changes: 2 additions & 1 deletion src/_gettsim/vorrangprüfungen/vorrangprüfungen.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

from __future__ import annotations

from _gettsim import WARNING_MSG_FOR_GETTSIM_BG_ID_WTHH_ID_ETC
from gettsim.tt import policy_function


@policy_function()
@policy_function(warn_msg_if_included=WARNING_MSG_FOR_GETTSIM_BG_ID_WTHH_ID_ETC)
def wohngeld_kinderzuschlag_vorrangig_oder_günstiger(
arbeitslosengeld_2__regelbedarf_m_bg: float,
arbeitslosengeld_2__anzurechnendes_einkommen_m_bg: float,
Expand Down
8 changes: 4 additions & 4 deletions src/_gettsim_tests/test_jittability.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from __future__ import annotations

import contextlib
import datetime
import functools
import inspect
from functools import lru_cache
from typing import TYPE_CHECKING, Literal

import dags.tree as dt
Expand All @@ -24,7 +23,7 @@ def get_orig_gettsim_column_functions() -> list[ColumnFunction]:
return [(tp, cf) for tp, cf in orig.items() if isinstance(cf, ColumnFunction)]


@lru_cache(maxsize=100)
@functools.lru_cache(maxsize=100)
def cached_specialized_environment(
policy_date: datetime.date,
backend: Literal["numpy", "jax"],
Expand Down Expand Up @@ -61,7 +60,8 @@ def test_jittable(tree_path, fun, backend, xnp):
else:
raise ValueError(f"Unknown column type: {arg.annotation}")

with contextlib.suppress(NotImplementedError):
func = env[qname].func if isinstance(env[qname], functools.partial) else env[qname]
if not func.fail_msg_if_included:
main(
main_target=("raw_results", "columns"),
policy_date=policy_date,
Expand Down
Loading