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.
Files changed (87) hide show
  1. {policyengine-3.1.0 → policyengine-3.1.1}/CHANGELOG.md +9 -0
  2. {policyengine-3.1.0 → policyengine-3.1.1}/PKG-INFO +1 -1
  3. {policyengine-3.1.0 → policyengine-3.1.1}/changelog.yaml +8 -0
  4. {policyengine-3.1.0 → policyengine-3.1.1}/pyproject.toml +1 -1
  5. policyengine-3.1.1/src/policyengine/__pycache__/__init__.cpython-313.pyc +0 -0
  6. policyengine-3.1.1/src/policyengine/core/dynamic.py +43 -0
  7. policyengine-3.1.1/src/policyengine/core/policy.py +43 -0
  8. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine.egg-info/PKG-INFO +1 -1
  9. policyengine-3.1.0/src/policyengine/__pycache__/__init__.cpython-313.pyc +0 -0
  10. policyengine-3.1.0/src/policyengine/core/dynamic.py +0 -17
  11. policyengine-3.1.0/src/policyengine/core/policy.py +0 -17
  12. {policyengine-3.1.0 → policyengine-3.1.1}/.github/CONTRIBUTING.md +0 -0
  13. {policyengine-3.1.0 → policyengine-3.1.1}/.github/changelog_template.md +0 -0
  14. {policyengine-3.1.0 → policyengine-3.1.1}/.github/fetch_version.py +0 -0
  15. {policyengine-3.1.0 → policyengine-3.1.1}/.github/get-changelog-diff.sh +0 -0
  16. {policyengine-3.1.0 → policyengine-3.1.1}/.github/has-functional-changes.sh +0 -0
  17. {policyengine-3.1.0 → policyengine-3.1.1}/.github/is-version-number-acceptable.sh +0 -0
  18. {policyengine-3.1.0 → policyengine-3.1.1}/.github/publish-git-tag.sh +0 -0
  19. {policyengine-3.1.0 → policyengine-3.1.1}/.github/workflows/code_changes.yaml +0 -0
  20. {policyengine-3.1.0 → policyengine-3.1.1}/.github/workflows/docs.yml +0 -0
  21. {policyengine-3.1.0 → policyengine-3.1.1}/.github/workflows/pr_code_changes.yaml +0 -0
  22. {policyengine-3.1.0 → policyengine-3.1.1}/.github/workflows/pr_docs_changes.yaml +0 -0
  23. {policyengine-3.1.0 → policyengine-3.1.1}/.github/workflows/versioning.yaml +0 -0
  24. {policyengine-3.1.0 → policyengine-3.1.1}/.gitignore +0 -0
  25. {policyengine-3.1.0 → policyengine-3.1.1}/CLAUDE.md +0 -0
  26. {policyengine-3.1.0 → policyengine-3.1.1}/LICENSE +0 -0
  27. {policyengine-3.1.0 → policyengine-3.1.1}/Makefile +0 -0
  28. {policyengine-3.1.0 → policyengine-3.1.1}/README.md +0 -0
  29. {policyengine-3.1.0 → policyengine-3.1.1}/changelog_entry.yaml +0 -0
  30. {policyengine-3.1.0 → policyengine-3.1.1}/docs/.gitignore +0 -0
  31. {policyengine-3.1.0 → policyengine-3.1.1}/docs/core-concepts.md +0 -0
  32. {policyengine-3.1.0 → policyengine-3.1.1}/docs/country-models-uk.md +0 -0
  33. {policyengine-3.1.0 → policyengine-3.1.1}/docs/country-models-us.md +0 -0
  34. {policyengine-3.1.0 → policyengine-3.1.1}/docs/dev.md +0 -0
  35. {policyengine-3.1.0 → policyengine-3.1.1}/docs/index.md +0 -0
  36. {policyengine-3.1.0 → policyengine-3.1.1}/docs/myst.yml +0 -0
  37. {policyengine-3.1.0 → policyengine-3.1.1}/docs/visualisation.md +0 -0
  38. {policyengine-3.1.0 → policyengine-3.1.1}/examples/employment_income_variation_uk.py +0 -0
  39. {policyengine-3.1.0 → policyengine-3.1.1}/examples/employment_income_variation_us.py +0 -0
  40. {policyengine-3.1.0 → policyengine-3.1.1}/examples/income_bands_uk.py +0 -0
  41. {policyengine-3.1.0 → policyengine-3.1.1}/examples/income_distribution_us.py +0 -0
  42. {policyengine-3.1.0 → policyengine-3.1.1}/examples/policy_change_uk.py +0 -0
  43. {policyengine-3.1.0 → policyengine-3.1.1}/examples/speedtest_us_simulation.py +0 -0
  44. {policyengine-3.1.0 → policyengine-3.1.1}/setup.cfg +0 -0
  45. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/__init__.py +0 -0
  46. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/core/__init__.py +0 -0
  47. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/core/dataset.py +0 -0
  48. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/core/dataset_version.py +0 -0
  49. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/core/output.py +0 -0
  50. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/core/parameter.py +0 -0
  51. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/core/parameter_value.py +0 -0
  52. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/core/simulation.py +0 -0
  53. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/core/tax_benefit_model.py +0 -0
  54. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/core/tax_benefit_model_version.py +0 -0
  55. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/core/variable.py +0 -0
  56. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/outputs/__init__.py +0 -0
  57. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/outputs/aggregate.py +0 -0
  58. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/outputs/change_aggregate.py +0 -0
  59. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/outputs/decile_impact.py +0 -0
  60. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/uk/__init__.py +0 -0
  61. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/uk/analysis.py +0 -0
  62. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/uk/datasets.py +0 -0
  63. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/uk/model.py +0 -0
  64. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/uk/outputs.py +0 -0
  65. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/uk.py +0 -0
  66. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/us/__init__.py +0 -0
  67. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/us/analysis.py +0 -0
  68. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/us/datasets.py +0 -0
  69. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/us/model.py +0 -0
  70. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/us/outputs.py +0 -0
  71. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/tax_benefit_models/us.py +0 -0
  72. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/utils/__init__.py +0 -0
  73. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/utils/dates.py +0 -0
  74. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/utils/parametric_reforms.py +0 -0
  75. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine/utils/plotting.py +0 -0
  76. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine.egg-info/SOURCES.txt +0 -0
  77. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine.egg-info/dependency_links.txt +0 -0
  78. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine.egg-info/requires.txt +0 -0
  79. {policyengine-3.1.0 → policyengine-3.1.1}/src/policyengine.egg-info/top_level.txt +0 -0
  80. {policyengine-3.1.0 → policyengine-3.1.1}/tests/test_aggregate.py +0 -0
  81. {policyengine-3.1.0 → policyengine-3.1.1}/tests/test_change_aggregate.py +0 -0
  82. {policyengine-3.1.0 → policyengine-3.1.1}/tests/test_entity_mapping.py +0 -0
  83. {policyengine-3.1.0 → policyengine-3.1.1}/tests/test_uk_dataset.py +0 -0
  84. {policyengine-3.1.0 → policyengine-3.1.1}/tests/test_us_datasets.py +0 -0
  85. {policyengine-3.1.0 → policyengine-3.1.1}/tests/test_us_entity_mapping.py +0 -0
  86. {policyengine-3.1.0 → policyengine-3.1.1}/tests/test_us_simulation.py +0 -0
  87. {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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: policyengine
3
- Version: 3.1.0
3
+ Version: 3.1.1
4
4
  Summary: A package to conduct policy analysis using PolicyEngine tax-benefit models.
5
5
  Author-email: PolicyEngine <hello@policyengine.org>
6
6
  License: GNU AFFERO GENERAL PUBLIC LICENSE
@@ -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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "policyengine"
7
- version = "3.1.0"
7
+ version = "3.1.1"
8
8
  description = "A package to conduct policy analysis using PolicyEngine tax-benefit models."
9
9
  readme = "README.md"
10
10
  authors = [
@@ -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
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: policyengine
3
- Version: 3.1.0
3
+ Version: 3.1.1
4
4
  Summary: A package to conduct policy analysis using PolicyEngine tax-benefit models.
5
5
  Author-email: PolicyEngine <hello@policyengine.org>
6
6
  License: GNU AFFERO GENERAL PUBLIC LICENSE
@@ -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