policyengine 3.1.13__tar.gz → 3.1.14__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {policyengine-3.1.13 → policyengine-3.1.14}/CHANGELOG.md +7 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/PKG-INFO +1 -1
- {policyengine-3.1.13 → policyengine-3.1.14}/changelog.yaml +5 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/pyproject.toml +1 -1
- policyengine-3.1.14/src/policyengine/__pycache__/__init__.cpython-313.pyc +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/tax_benefit_models/uk/datasets.py +2 -2
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/tax_benefit_models/us/datasets.py +2 -2
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/tax_benefit_models/us/model.py +1 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine.egg-info/PKG-INFO +1 -1
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine.egg-info/SOURCES.txt +2 -1
- policyengine-3.1.14/tests/test_models.py +68 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/uv.lock +3 -1
- policyengine-3.1.13/src/policyengine/__pycache__/__init__.cpython-313.pyc +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/.claude/policyengine-guide.md +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/.claude/quick-reference.md +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/.github/CONTRIBUTING.md +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/.github/changelog_template.md +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/.github/fetch_version.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/.github/get-changelog-diff.sh +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/.github/has-functional-changes.sh +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/.github/is-version-number-acceptable.sh +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/.github/publish-git-tag.sh +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/.github/workflows/code_changes.yaml +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/.github/workflows/docs.yml +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/.github/workflows/pr_code_changes.yaml +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/.github/workflows/pr_docs_changes.yaml +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/.github/workflows/versioning.yaml +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/.gitignore +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/CLAUDE.md +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/LICENSE +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/Makefile +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/README.md +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/changelog_entry.yaml +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/docs/.gitignore +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/docs/core-concepts.md +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/docs/country-models-uk.md +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/docs/country-models-us.md +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/docs/dev.md +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/docs/index.md +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/docs/myst.yml +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/docs/visualisation.md +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/examples/employment_income_variation_uk.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/examples/employment_income_variation_us.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/examples/income_bands_uk.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/examples/income_distribution_us.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/examples/policy_change_uk.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/examples/speedtest_us_simulation.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/setup.cfg +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/__init__.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/core/__init__.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/core/cache.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/core/dataset.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/core/dataset_version.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/core/dynamic.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/core/output.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/core/parameter.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/core/parameter_value.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/core/policy.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/core/simulation.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/core/tax_benefit_model.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/core/tax_benefit_model_version.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/core/variable.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/outputs/__init__.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/outputs/aggregate.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/outputs/change_aggregate.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/outputs/decile_impact.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/tax_benefit_models/uk/__init__.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/tax_benefit_models/uk/analysis.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/tax_benefit_models/uk/model.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/tax_benefit_models/uk/outputs.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/tax_benefit_models/uk.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/tax_benefit_models/us/__init__.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/tax_benefit_models/us/analysis.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/tax_benefit_models/us/outputs.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/tax_benefit_models/us.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/utils/__init__.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/utils/dates.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/utils/parametric_reforms.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/utils/plotting.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine.egg-info/dependency_links.txt +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine.egg-info/requires.txt +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine.egg-info/top_level.txt +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/tests/test_aggregate.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/tests/test_cache.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/tests/test_change_aggregate.py +0 -0
- {policyengine-3.1.13 → policyengine-3.1.14}/tests/test_entity_mapping.py +0 -0
|
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [3.1.14] - 2025-12-10 21:59:24
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Improvements to loading taxbenefitsystems.
|
|
13
|
+
|
|
8
14
|
## [3.1.13] - 2025-12-10 19:29:28
|
|
9
15
|
|
|
10
16
|
### Fixed
|
|
@@ -275,6 +281,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
275
281
|
|
|
276
282
|
|
|
277
283
|
|
|
284
|
+
[3.1.14]: https://github.com/PolicyEngine/policyengine.py/compare/3.1.13...3.1.14
|
|
278
285
|
[3.1.13]: https://github.com/PolicyEngine/policyengine.py/compare/3.1.12...3.1.13
|
|
279
286
|
[3.1.12]: https://github.com/PolicyEngine/policyengine.py/compare/3.1.11...3.1.12
|
|
280
287
|
[3.1.11]: https://github.com/PolicyEngine/policyengine.py/compare/3.1.10...3.1.11
|
{policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/tax_benefit_models/uk/datasets.py
RENAMED
|
@@ -196,8 +196,8 @@ def load_datasets(
|
|
|
196
196
|
for year in years:
|
|
197
197
|
filepath = f"{data_folder}/{Path(dataset).stem}_year_{year}.h5"
|
|
198
198
|
uk_dataset = PolicyEngineUKDataset(
|
|
199
|
-
name=f"{dataset}-year-{year}",
|
|
200
|
-
description=f"UK Dataset for year {year} based on {dataset}",
|
|
199
|
+
name=f"{Path(dataset).stem}-year-{year}",
|
|
200
|
+
description=f"UK Dataset for year {year} based on {Path(dataset).stem}",
|
|
201
201
|
filepath=filepath,
|
|
202
202
|
year=int(year),
|
|
203
203
|
)
|
{policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/tax_benefit_models/us/datasets.py
RENAMED
|
@@ -317,8 +317,8 @@ def load_datasets(
|
|
|
317
317
|
for year in years:
|
|
318
318
|
filepath = f"{data_folder}/{Path(dataset).stem}_year_{year}.h5"
|
|
319
319
|
us_dataset = PolicyEngineUSDataset(
|
|
320
|
-
name=f"{dataset}-year-{year}",
|
|
321
|
-
description=f"US Dataset for year {year} based on {dataset}",
|
|
320
|
+
name=f"{Path(dataset).stem}-year-{year}",
|
|
321
|
+
description=f"US Dataset for year {year} based on {Path(dataset).stem}",
|
|
322
322
|
filepath=filepath,
|
|
323
323
|
year=year,
|
|
324
324
|
)
|
|
@@ -141,6 +141,7 @@ class PolicyEngineUSLatest(TaxBenefitModelVersion):
|
|
|
141
141
|
parameter = Parameter(
|
|
142
142
|
id=self.id + "-" + param_node.name,
|
|
143
143
|
name=param_node.name,
|
|
144
|
+
label=param_node.metadata.get("label"),
|
|
144
145
|
tax_benefit_model_version=self,
|
|
145
146
|
description=param_node.description,
|
|
146
147
|
data_type=type(param_node(2025)),
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"""Tests for UK and US tax-benefit model versions."""
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
from policyengine.tax_benefit_models.uk import uk_latest
|
|
6
|
+
from policyengine.tax_benefit_models.us import us_latest
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class TestUKModel:
|
|
10
|
+
"""Tests for PolicyEngine UK model."""
|
|
11
|
+
|
|
12
|
+
def test_has_hundreds_of_parameters(self):
|
|
13
|
+
"""UK model should have hundreds of parameters."""
|
|
14
|
+
assert len(uk_latest.parameters) >= 100
|
|
15
|
+
|
|
16
|
+
def test_has_hundreds_of_variables(self):
|
|
17
|
+
"""UK model should have hundreds of variables."""
|
|
18
|
+
assert len(uk_latest.variables) >= 100
|
|
19
|
+
|
|
20
|
+
def test_parameters_have_values(self):
|
|
21
|
+
"""Each parameter should have at least one parameter value."""
|
|
22
|
+
total_values = 0
|
|
23
|
+
for param in uk_latest.parameters[:100]: # Check first 100 for speed
|
|
24
|
+
values = param.parameter_values
|
|
25
|
+
assert len(values) >= 1, f"Parameter {param.name} has no values"
|
|
26
|
+
total_values += len(values)
|
|
27
|
+
|
|
28
|
+
# Should have many parameter values in total
|
|
29
|
+
assert total_values >= 100
|
|
30
|
+
|
|
31
|
+
def test_parameter_values_have_required_fields(self):
|
|
32
|
+
"""Parameter values should have start_date and value."""
|
|
33
|
+
for param in uk_latest.parameters[:50]:
|
|
34
|
+
for pv in param.parameter_values:
|
|
35
|
+
assert pv.start_date is not None
|
|
36
|
+
assert pv.value is not None
|
|
37
|
+
assert pv.parameter is param
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class TestUSModel:
|
|
41
|
+
"""Tests for PolicyEngine US model."""
|
|
42
|
+
|
|
43
|
+
def test_has_hundreds_of_parameters(self):
|
|
44
|
+
"""US model should have hundreds of parameters."""
|
|
45
|
+
assert len(us_latest.parameters) >= 100
|
|
46
|
+
|
|
47
|
+
def test_has_hundreds_of_variables(self):
|
|
48
|
+
"""US model should have hundreds of variables."""
|
|
49
|
+
assert len(us_latest.variables) >= 100
|
|
50
|
+
|
|
51
|
+
def test_parameters_have_values(self):
|
|
52
|
+
"""Each parameter should have at least one parameter value."""
|
|
53
|
+
total_values = 0
|
|
54
|
+
for param in us_latest.parameters[:100]: # Check first 100 for speed
|
|
55
|
+
values = param.parameter_values
|
|
56
|
+
assert len(values) >= 1, f"Parameter {param.name} has no values"
|
|
57
|
+
total_values += len(values)
|
|
58
|
+
|
|
59
|
+
# Should have many parameter values in total
|
|
60
|
+
assert total_values >= 100
|
|
61
|
+
|
|
62
|
+
def test_parameter_values_have_required_fields(self):
|
|
63
|
+
"""Parameter values should have start_date and value."""
|
|
64
|
+
for param in us_latest.parameters[:50]:
|
|
65
|
+
for pv in param.parameter_values:
|
|
66
|
+
assert pv.start_date is not None
|
|
67
|
+
assert pv.value is not None
|
|
68
|
+
assert pv.parameter is param
|
|
@@ -1080,12 +1080,13 @@ wheels = [
|
|
|
1080
1080
|
|
|
1081
1081
|
[[package]]
|
|
1082
1082
|
name = "policyengine"
|
|
1083
|
-
version = "3.1.
|
|
1083
|
+
version = "3.1.12"
|
|
1084
1084
|
source = { editable = "." }
|
|
1085
1085
|
dependencies = [
|
|
1086
1086
|
{ name = "microdf-python" },
|
|
1087
1087
|
{ name = "pandas" },
|
|
1088
1088
|
{ name = "plotly" },
|
|
1089
|
+
{ name = "psutil" },
|
|
1089
1090
|
{ name = "pydantic" },
|
|
1090
1091
|
{ name = "requests" },
|
|
1091
1092
|
]
|
|
@@ -1133,6 +1134,7 @@ requires-dist = [
|
|
|
1133
1134
|
{ name = "policyengine-uk", marker = "extra == 'uk'", specifier = ">=2.51.0" },
|
|
1134
1135
|
{ name = "policyengine-us", marker = "extra == 'dev'", specifier = ">=1.213.1" },
|
|
1135
1136
|
{ name = "policyengine-us", marker = "extra == 'us'", specifier = ">=1.213.1" },
|
|
1137
|
+
{ name = "psutil", specifier = ">=5.9.0" },
|
|
1136
1138
|
{ name = "pydantic", specifier = ">=2.0.0" },
|
|
1137
1139
|
{ name = "pytest", marker = "extra == 'dev'" },
|
|
1138
1140
|
{ name = "pytest-asyncio", marker = "extra == 'dev'", specifier = ">=0.26.0" },
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/core/tax_benefit_model_version.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/tax_benefit_models/uk/__init__.py
RENAMED
|
File without changes
|
{policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/tax_benefit_models/uk/analysis.py
RENAMED
|
File without changes
|
|
File without changes
|
{policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/tax_benefit_models/uk/outputs.py
RENAMED
|
File without changes
|
|
File without changes
|
{policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/tax_benefit_models/us/__init__.py
RENAMED
|
File without changes
|
{policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/tax_benefit_models/us/analysis.py
RENAMED
|
File without changes
|
{policyengine-3.1.13 → policyengine-3.1.14}/src/policyengine/tax_benefit_models/us/outputs.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|