policyengine 3.1.0__tar.gz → 3.1.1__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.0 → policyengine-3.1.1}/CHANGELOG.md +9 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/PKG-INFO +1 -1
- {policyengine-3.1.0 → policyengine-3.1.1}/changelog.yaml +8 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/pyproject.toml +1 -1
- policyengine-3.1.1/src/policyengine/__pycache__/__init__.cpython-313.pyc +0 -0
- policyengine-3.1.1/src/policyengine/core/dynamic.py +43 -0
- policyengine-3.1.1/src/policyengine/core/policy.py +43 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine.egg-info/PKG-INFO +1 -1
- policyengine-3.1.0/src/policyengine/__pycache__/__init__.cpython-313.pyc +0 -0
- policyengine-3.1.0/src/policyengine/core/dynamic.py +0 -17
- policyengine-3.1.0/src/policyengine/core/policy.py +0 -17
- {policyengine-3.1.0 → policyengine-3.1.1}/.github/CONTRIBUTING.md +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/.github/changelog_template.md +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/.github/fetch_version.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/.github/get-changelog-diff.sh +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/.github/has-functional-changes.sh +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/.github/is-version-number-acceptable.sh +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/.github/publish-git-tag.sh +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/.github/workflows/code_changes.yaml +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/.github/workflows/docs.yml +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/.github/workflows/pr_code_changes.yaml +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/.github/workflows/pr_docs_changes.yaml +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/.github/workflows/versioning.yaml +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/.gitignore +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/CLAUDE.md +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/LICENSE +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/Makefile +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/README.md +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/changelog_entry.yaml +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/docs/.gitignore +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/docs/core-concepts.md +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/docs/country-models-uk.md +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/docs/country-models-us.md +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/docs/dev.md +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/docs/index.md +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/docs/myst.yml +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/docs/visualisation.md +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/examples/employment_income_variation_uk.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/examples/employment_income_variation_us.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/examples/income_bands_uk.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/examples/income_distribution_us.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/examples/policy_change_uk.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/examples/speedtest_us_simulation.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/setup.cfg +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/__init__.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/core/__init__.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/core/dataset.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/core/dataset_version.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/core/output.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/core/parameter.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/core/parameter_value.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/core/simulation.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/core/tax_benefit_model.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/core/tax_benefit_model_version.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/core/variable.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/outputs/__init__.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/outputs/aggregate.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/outputs/change_aggregate.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/outputs/decile_impact.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/uk/__init__.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/uk/analysis.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/uk/datasets.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/uk/model.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/uk/outputs.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/uk.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/us/__init__.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/us/analysis.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/us/datasets.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/us/model.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/us/outputs.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/us.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/utils/__init__.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/utils/dates.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/utils/parametric_reforms.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/utils/plotting.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine.egg-info/SOURCES.txt +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine.egg-info/dependency_links.txt +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine.egg-info/requires.txt +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine.egg-info/top_level.txt +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/tests/test_aggregate.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/tests/test_change_aggregate.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/tests/test_entity_mapping.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/tests/test_uk_dataset.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/tests/test_us_datasets.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/tests/test_us_entity_mapping.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/tests/test_us_simulation.py +0 -0
- {policyengine-3.1.0 → policyengine-3.1.1}/uv.lock +0 -0
|
@@ -5,6 +5,14 @@ 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.1] - 2025-11-17 11:45:43
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Policy and Dynamic classes now support addition operator (__add__) to combine policies and dynamics.
|
|
13
|
+
- Parameter values are appended when combining policies/dynamics.
|
|
14
|
+
- Simulation modifiers are chained in sequence when combining policies/dynamics.
|
|
15
|
+
|
|
8
16
|
## [3.1.0] - 2025-11-17 10:25:50
|
|
9
17
|
|
|
10
18
|
## [3.0.0] - 2025-09-23 08:43:22
|
|
@@ -195,6 +203,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
195
203
|
|
|
196
204
|
|
|
197
205
|
|
|
206
|
+
[3.1.1]: https://github.com/PolicyEngine/policyengine.py/compare/3.1.0...3.1.1
|
|
198
207
|
[3.1.0]: https://github.com/PolicyEngine/policyengine.py/compare/3.0.0...3.1.0
|
|
199
208
|
[3.0.0]: https://github.com/PolicyEngine/policyengine.py/compare/2.0.0...3.0.0
|
|
200
209
|
[2.0.0]: https://github.com/PolicyEngine/policyengine.py/compare/1.0.0...2.0.0
|
|
@@ -157,3 +157,11 @@
|
|
|
157
157
|
- Just basemodels, no sqlmodels.
|
|
158
158
|
- Clean, working analysis at both household and macro level for uk and us.
|
|
159
159
|
date: 2025-11-17 10:25:50
|
|
160
|
+
- bump: patch
|
|
161
|
+
changes:
|
|
162
|
+
added:
|
|
163
|
+
- Policy and Dynamic classes now support addition operator (__add__) to combine
|
|
164
|
+
policies and dynamics.
|
|
165
|
+
- Parameter values are appended when combining policies/dynamics.
|
|
166
|
+
- Simulation modifiers are chained in sequence when combining policies/dynamics.
|
|
167
|
+
date: 2025-11-17 11:45:43
|
|
Binary file
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from collections.abc import Callable
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
from uuid import uuid4
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, Field
|
|
6
|
+
|
|
7
|
+
from .parameter_value import ParameterValue
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Dynamic(BaseModel):
|
|
11
|
+
id: str = Field(default_factory=lambda: str(uuid4()))
|
|
12
|
+
name: str
|
|
13
|
+
description: str | None = None
|
|
14
|
+
parameter_values: list[ParameterValue] = []
|
|
15
|
+
simulation_modifier: Callable | None = None
|
|
16
|
+
created_at: datetime = Field(default_factory=datetime.now)
|
|
17
|
+
updated_at: datetime = Field(default_factory=datetime.now)
|
|
18
|
+
|
|
19
|
+
def __add__(self, other: "Dynamic") -> "Dynamic":
|
|
20
|
+
"""Combine two dynamics by appending parameter values and chaining simulation modifiers."""
|
|
21
|
+
if not isinstance(other, Dynamic):
|
|
22
|
+
return NotImplemented
|
|
23
|
+
|
|
24
|
+
# Combine simulation modifiers
|
|
25
|
+
combined_modifier = None
|
|
26
|
+
if self.simulation_modifier is not None and other.simulation_modifier is not None:
|
|
27
|
+
|
|
28
|
+
def combined_modifier(sim):
|
|
29
|
+
sim = self.simulation_modifier(sim)
|
|
30
|
+
sim = other.simulation_modifier(sim)
|
|
31
|
+
return sim
|
|
32
|
+
|
|
33
|
+
elif self.simulation_modifier is not None:
|
|
34
|
+
combined_modifier = self.simulation_modifier
|
|
35
|
+
elif other.simulation_modifier is not None:
|
|
36
|
+
combined_modifier = other.simulation_modifier
|
|
37
|
+
|
|
38
|
+
return Dynamic(
|
|
39
|
+
name=f"{self.name} + {other.name}",
|
|
40
|
+
description=f"Combined dynamic: {self.name} and {other.name}",
|
|
41
|
+
parameter_values=self.parameter_values + other.parameter_values,
|
|
42
|
+
simulation_modifier=combined_modifier,
|
|
43
|
+
)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from collections.abc import Callable
|
|
2
|
+
from datetime import datetime
|
|
3
|
+
from uuid import uuid4
|
|
4
|
+
|
|
5
|
+
from pydantic import BaseModel, Field
|
|
6
|
+
|
|
7
|
+
from .parameter_value import ParameterValue
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Policy(BaseModel):
|
|
11
|
+
id: str = Field(default_factory=lambda: str(uuid4()))
|
|
12
|
+
name: str
|
|
13
|
+
description: str | None = None
|
|
14
|
+
parameter_values: list[ParameterValue] = []
|
|
15
|
+
simulation_modifier: Callable | None = None
|
|
16
|
+
created_at: datetime = Field(default_factory=datetime.now)
|
|
17
|
+
updated_at: datetime = Field(default_factory=datetime.now)
|
|
18
|
+
|
|
19
|
+
def __add__(self, other: "Policy") -> "Policy":
|
|
20
|
+
"""Combine two policies by appending parameter values and chaining simulation modifiers."""
|
|
21
|
+
if not isinstance(other, Policy):
|
|
22
|
+
return NotImplemented
|
|
23
|
+
|
|
24
|
+
# Combine simulation modifiers
|
|
25
|
+
combined_modifier = None
|
|
26
|
+
if self.simulation_modifier is not None and other.simulation_modifier is not None:
|
|
27
|
+
|
|
28
|
+
def combined_modifier(sim):
|
|
29
|
+
sim = self.simulation_modifier(sim)
|
|
30
|
+
sim = other.simulation_modifier(sim)
|
|
31
|
+
return sim
|
|
32
|
+
|
|
33
|
+
elif self.simulation_modifier is not None:
|
|
34
|
+
combined_modifier = self.simulation_modifier
|
|
35
|
+
elif other.simulation_modifier is not None:
|
|
36
|
+
combined_modifier = other.simulation_modifier
|
|
37
|
+
|
|
38
|
+
return Policy(
|
|
39
|
+
name=f"{self.name} + {other.name}",
|
|
40
|
+
description=f"Combined policy: {self.name} and {other.name}",
|
|
41
|
+
parameter_values=self.parameter_values + other.parameter_values,
|
|
42
|
+
simulation_modifier=combined_modifier,
|
|
43
|
+
)
|
|
Binary file
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
from collections.abc import Callable
|
|
2
|
-
from datetime import datetime
|
|
3
|
-
from uuid import uuid4
|
|
4
|
-
|
|
5
|
-
from pydantic import BaseModel, Field
|
|
6
|
-
|
|
7
|
-
from .parameter_value import ParameterValue
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Dynamic(BaseModel):
|
|
11
|
-
id: str = Field(default_factory=lambda: str(uuid4()))
|
|
12
|
-
name: str
|
|
13
|
-
description: str | None = None
|
|
14
|
-
parameter_values: list[ParameterValue] = []
|
|
15
|
-
simulation_modifier: Callable | None = None
|
|
16
|
-
created_at: datetime = Field(default_factory=datetime.now)
|
|
17
|
-
updated_at: datetime = Field(default_factory=datetime.now)
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
from collections.abc import Callable
|
|
2
|
-
from datetime import datetime
|
|
3
|
-
from uuid import uuid4
|
|
4
|
-
|
|
5
|
-
from pydantic import BaseModel, Field
|
|
6
|
-
|
|
7
|
-
from .parameter_value import ParameterValue
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Policy(BaseModel):
|
|
11
|
-
id: str = Field(default_factory=lambda: str(uuid4()))
|
|
12
|
-
name: str
|
|
13
|
-
description: str | None = None
|
|
14
|
-
parameter_values: list[ParameterValue] = []
|
|
15
|
-
simulation_modifier: Callable | None = None
|
|
16
|
-
created_at: datetime = Field(default_factory=datetime.now)
|
|
17
|
-
updated_at: datetime = Field(default_factory=datetime.now)
|
|
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.0 → policyengine-3.1.1}/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.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/uk/__init__.py
RENAMED
|
File without changes
|
{policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/uk/analysis.py
RENAMED
|
File without changes
|
{policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/uk/datasets.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/us/__init__.py
RENAMED
|
File without changes
|
{policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/us/analysis.py
RENAMED
|
File without changes
|
{policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/us/datasets.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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|