policyengine 3.1.2__tar.gz → 3.1.3__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 (88) hide show
  1. {policyengine-3.1.2 → policyengine-3.1.3}/CHANGELOG.md +7 -0
  2. {policyengine-3.1.2 → policyengine-3.1.3}/PKG-INFO +1 -1
  3. {policyengine-3.1.2 → policyengine-3.1.3}/changelog.yaml +5 -0
  4. {policyengine-3.1.2 → policyengine-3.1.3}/pyproject.toml +1 -1
  5. policyengine-3.1.3/src/policyengine/__pycache__/__init__.cpython-313.pyc +0 -0
  6. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/tax_benefit_models/uk/model.py +68 -68
  7. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/tax_benefit_models/us/model.py +54 -54
  8. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine.egg-info/PKG-INFO +1 -1
  9. policyengine-3.1.2/src/policyengine/__pycache__/__init__.cpython-313.pyc +0 -0
  10. {policyengine-3.1.2 → policyengine-3.1.3}/.claude/policyengine-guide.md +0 -0
  11. {policyengine-3.1.2 → policyengine-3.1.3}/.claude/quick-reference.md +0 -0
  12. {policyengine-3.1.2 → policyengine-3.1.3}/.github/CONTRIBUTING.md +0 -0
  13. {policyengine-3.1.2 → policyengine-3.1.3}/.github/changelog_template.md +0 -0
  14. {policyengine-3.1.2 → policyengine-3.1.3}/.github/fetch_version.py +0 -0
  15. {policyengine-3.1.2 → policyengine-3.1.3}/.github/get-changelog-diff.sh +0 -0
  16. {policyengine-3.1.2 → policyengine-3.1.3}/.github/has-functional-changes.sh +0 -0
  17. {policyengine-3.1.2 → policyengine-3.1.3}/.github/is-version-number-acceptable.sh +0 -0
  18. {policyengine-3.1.2 → policyengine-3.1.3}/.github/publish-git-tag.sh +0 -0
  19. {policyengine-3.1.2 → policyengine-3.1.3}/.github/workflows/code_changes.yaml +0 -0
  20. {policyengine-3.1.2 → policyengine-3.1.3}/.github/workflows/docs.yml +0 -0
  21. {policyengine-3.1.2 → policyengine-3.1.3}/.github/workflows/pr_code_changes.yaml +0 -0
  22. {policyengine-3.1.2 → policyengine-3.1.3}/.github/workflows/pr_docs_changes.yaml +0 -0
  23. {policyengine-3.1.2 → policyengine-3.1.3}/.github/workflows/versioning.yaml +0 -0
  24. {policyengine-3.1.2 → policyengine-3.1.3}/.gitignore +0 -0
  25. {policyengine-3.1.2 → policyengine-3.1.3}/CLAUDE.md +0 -0
  26. {policyengine-3.1.2 → policyengine-3.1.3}/LICENSE +0 -0
  27. {policyengine-3.1.2 → policyengine-3.1.3}/Makefile +0 -0
  28. {policyengine-3.1.2 → policyengine-3.1.3}/README.md +0 -0
  29. {policyengine-3.1.2 → policyengine-3.1.3}/changelog_entry.yaml +0 -0
  30. {policyengine-3.1.2 → policyengine-3.1.3}/docs/.gitignore +0 -0
  31. {policyengine-3.1.2 → policyengine-3.1.3}/docs/core-concepts.md +0 -0
  32. {policyengine-3.1.2 → policyengine-3.1.3}/docs/country-models-uk.md +0 -0
  33. {policyengine-3.1.2 → policyengine-3.1.3}/docs/country-models-us.md +0 -0
  34. {policyengine-3.1.2 → policyengine-3.1.3}/docs/dev.md +0 -0
  35. {policyengine-3.1.2 → policyengine-3.1.3}/docs/index.md +0 -0
  36. {policyengine-3.1.2 → policyengine-3.1.3}/docs/myst.yml +0 -0
  37. {policyengine-3.1.2 → policyengine-3.1.3}/docs/visualisation.md +0 -0
  38. {policyengine-3.1.2 → policyengine-3.1.3}/examples/employment_income_variation_uk.py +0 -0
  39. {policyengine-3.1.2 → policyengine-3.1.3}/examples/employment_income_variation_us.py +0 -0
  40. {policyengine-3.1.2 → policyengine-3.1.3}/examples/income_bands_uk.py +0 -0
  41. {policyengine-3.1.2 → policyengine-3.1.3}/examples/income_distribution_us.py +0 -0
  42. {policyengine-3.1.2 → policyengine-3.1.3}/examples/policy_change_uk.py +0 -0
  43. {policyengine-3.1.2 → policyengine-3.1.3}/examples/speedtest_us_simulation.py +0 -0
  44. {policyengine-3.1.2 → policyengine-3.1.3}/setup.cfg +0 -0
  45. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/__init__.py +0 -0
  46. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/core/__init__.py +0 -0
  47. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/core/dataset.py +0 -0
  48. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/core/dataset_version.py +0 -0
  49. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/core/dynamic.py +0 -0
  50. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/core/output.py +0 -0
  51. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/core/parameter.py +0 -0
  52. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/core/parameter_value.py +0 -0
  53. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/core/policy.py +0 -0
  54. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/core/simulation.py +0 -0
  55. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/core/tax_benefit_model.py +0 -0
  56. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/core/tax_benefit_model_version.py +0 -0
  57. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/core/variable.py +0 -0
  58. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/outputs/__init__.py +0 -0
  59. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/outputs/aggregate.py +0 -0
  60. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/outputs/change_aggregate.py +0 -0
  61. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/outputs/decile_impact.py +0 -0
  62. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/tax_benefit_models/uk/__init__.py +0 -0
  63. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/tax_benefit_models/uk/analysis.py +0 -0
  64. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/tax_benefit_models/uk/datasets.py +0 -0
  65. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/tax_benefit_models/uk/outputs.py +0 -0
  66. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/tax_benefit_models/uk.py +0 -0
  67. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/tax_benefit_models/us/__init__.py +0 -0
  68. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/tax_benefit_models/us/analysis.py +0 -0
  69. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/tax_benefit_models/us/datasets.py +0 -0
  70. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/tax_benefit_models/us/outputs.py +0 -0
  71. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/tax_benefit_models/us.py +0 -0
  72. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/utils/__init__.py +0 -0
  73. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/utils/dates.py +0 -0
  74. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/utils/parametric_reforms.py +0 -0
  75. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine/utils/plotting.py +0 -0
  76. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine.egg-info/SOURCES.txt +0 -0
  77. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine.egg-info/dependency_links.txt +0 -0
  78. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine.egg-info/requires.txt +0 -0
  79. {policyengine-3.1.2 → policyengine-3.1.3}/src/policyengine.egg-info/top_level.txt +0 -0
  80. {policyengine-3.1.2 → policyengine-3.1.3}/tests/test_aggregate.py +0 -0
  81. {policyengine-3.1.2 → policyengine-3.1.3}/tests/test_change_aggregate.py +0 -0
  82. {policyengine-3.1.2 → policyengine-3.1.3}/tests/test_entity_mapping.py +0 -0
  83. {policyengine-3.1.2 → policyengine-3.1.3}/tests/test_get_parameter_variable.py +0 -0
  84. {policyengine-3.1.2 → policyengine-3.1.3}/tests/test_uk_dataset.py +0 -0
  85. {policyengine-3.1.2 → policyengine-3.1.3}/tests/test_us_datasets.py +0 -0
  86. {policyengine-3.1.2 → policyengine-3.1.3}/tests/test_us_entity_mapping.py +0 -0
  87. {policyengine-3.1.2 → policyengine-3.1.3}/tests/test_us_simulation.py +0 -0
  88. {policyengine-3.1.2 → policyengine-3.1.3}/uv.lock +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.3] - 2025-11-18 13:46:23
9
+
10
+ ### Fixed
11
+
12
+ - Entity variables moved out to an editable constant.
13
+
8
14
  ## [3.1.2] - 2025-11-18 11:09:18
9
15
 
10
16
  ### Fixed
@@ -209,6 +215,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
209
215
 
210
216
 
211
217
 
218
+ [3.1.3]: https://github.com/PolicyEngine/policyengine.py/compare/3.1.2...3.1.3
212
219
  [3.1.2]: https://github.com/PolicyEngine/policyengine.py/compare/3.1.1...3.1.2
213
220
  [3.1.1]: https://github.com/PolicyEngine/policyengine.py/compare/3.1.0...3.1.1
214
221
  [3.1.0]: https://github.com/PolicyEngine/policyengine.py/compare/3.0.0...3.1.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: policyengine
3
- Version: 3.1.2
3
+ Version: 3.1.3
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
@@ -170,3 +170,8 @@
170
170
  fixed:
171
171
  - Standardised saving and loading of simulations.
172
172
  date: 2025-11-18 11:09:18
173
+ - bump: patch
174
+ changes:
175
+ fixed:
176
+ - Entity variables moved out to an editable constant.
177
+ date: 2025-11-18 13:46:23
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "policyengine"
7
- version = "3.1.2"
7
+ version = "3.1.3"
8
8
  description = "A package to conduct policy analysis using PolicyEngine tax-benefit models."
9
9
  readme = "README.md"
10
10
  authors = [
@@ -44,6 +44,73 @@ class PolicyEngineUKLatest(TaxBenefitModelVersion):
44
44
  upload_time
45
45
  )
46
46
 
47
+ entity_variables: dict[str, list[str]] = {
48
+ "person": [
49
+ # IDs and weights
50
+ "person_id",
51
+ "benunit_id",
52
+ "household_id",
53
+ "person_weight",
54
+ # Demographics
55
+ "age",
56
+ "gender",
57
+ "is_adult",
58
+ "is_SP_age",
59
+ "is_child",
60
+ # Income
61
+ "employment_income",
62
+ "self_employment_income",
63
+ "pension_income",
64
+ "private_pension_income",
65
+ "savings_interest_income",
66
+ "dividend_income",
67
+ "property_income",
68
+ "total_income",
69
+ "earned_income",
70
+ # Benefits
71
+ "universal_credit",
72
+ "child_benefit",
73
+ "pension_credit",
74
+ "income_support",
75
+ "working_tax_credit",
76
+ "child_tax_credit",
77
+ # Tax
78
+ "income_tax",
79
+ "national_insurance",
80
+ ],
81
+ "benunit": [
82
+ # IDs and weights
83
+ "benunit_id",
84
+ "benunit_weight",
85
+ # Structure
86
+ "family_type",
87
+ # Income and benefits
88
+ "universal_credit",
89
+ "child_benefit",
90
+ "working_tax_credit",
91
+ "child_tax_credit",
92
+ ],
93
+ "household": [
94
+ # IDs and weights
95
+ "household_id",
96
+ "household_weight",
97
+ # Income measures
98
+ "household_net_income",
99
+ "hbai_household_net_income",
100
+ "equiv_hbai_household_net_income",
101
+ "household_market_income",
102
+ "household_gross_income",
103
+ # Benefits and tax
104
+ "household_benefits",
105
+ "household_tax",
106
+ "vat",
107
+ # Housing
108
+ "rent",
109
+ "council_tax",
110
+ "tenure_type",
111
+ ],
112
+ }
113
+
47
114
  def __init__(self, **kwargs: dict):
48
115
  super().__init__(**kwargs)
49
116
  from policyengine_core.enums import Enum
@@ -153,80 +220,13 @@ class PolicyEngineUKLatest(TaxBenefitModelVersion):
153
220
  )
154
221
  modifier(microsim)
155
222
 
156
- entity_variables = {
157
- "person": [
158
- # IDs and weights
159
- "person_id",
160
- "benunit_id",
161
- "household_id",
162
- "person_weight",
163
- # Demographics
164
- "age",
165
- "gender",
166
- "is_adult",
167
- "is_SP_age",
168
- "is_child",
169
- # Income
170
- "employment_income",
171
- "self_employment_income",
172
- "pension_income",
173
- "private_pension_income",
174
- "savings_interest_income",
175
- "dividend_income",
176
- "property_income",
177
- "total_income",
178
- "earned_income",
179
- # Benefits
180
- "universal_credit",
181
- "child_benefit",
182
- "pension_credit",
183
- "income_support",
184
- "working_tax_credit",
185
- "child_tax_credit",
186
- # Tax
187
- "income_tax",
188
- "national_insurance",
189
- ],
190
- "benunit": [
191
- # IDs and weights
192
- "benunit_id",
193
- "benunit_weight",
194
- # Structure
195
- "family_type",
196
- # Income and benefits
197
- "universal_credit",
198
- "child_benefit",
199
- "working_tax_credit",
200
- "child_tax_credit",
201
- ],
202
- "household": [
203
- # IDs and weights
204
- "household_id",
205
- "household_weight",
206
- # Income measures
207
- "household_net_income",
208
- "hbai_household_net_income",
209
- "equiv_hbai_household_net_income",
210
- "household_market_income",
211
- "household_gross_income",
212
- # Benefits and tax
213
- "household_benefits",
214
- "household_tax",
215
- "vat",
216
- # Housing
217
- "rent",
218
- "council_tax",
219
- "tenure_type",
220
- ],
221
- }
222
-
223
223
  data = {
224
224
  "person": pd.DataFrame(),
225
225
  "benunit": pd.DataFrame(),
226
226
  "household": pd.DataFrame(),
227
227
  }
228
228
 
229
- for entity, variables in entity_variables.items():
229
+ for entity, variables in self.entity_variables.items():
230
230
  for var in variables:
231
231
  data[entity][var] = microsim.calculate(
232
232
  var, period=simulation.dataset.year, map_to=entity
@@ -45,6 +45,59 @@ class PolicyEngineUSLatest(TaxBenefitModelVersion):
45
45
  version: str = None
46
46
  created_at: datetime.datetime = None
47
47
 
48
+ entity_variables: dict[str, list[str]] = {
49
+ "person": [
50
+ # IDs and weights
51
+ "person_id",
52
+ "marital_unit_id",
53
+ "family_id",
54
+ "spm_unit_id",
55
+ "tax_unit_id",
56
+ "household_id",
57
+ "person_weight",
58
+ # Demographics
59
+ "age",
60
+ # Income
61
+ "employment_income",
62
+ # Benefits
63
+ "ssi",
64
+ "social_security",
65
+ "medicaid",
66
+ "unemployment_compensation",
67
+ ],
68
+ "marital_unit": [
69
+ "marital_unit_id",
70
+ "marital_unit_weight",
71
+ ],
72
+ "family": [
73
+ "family_id",
74
+ "family_weight",
75
+ ],
76
+ "spm_unit": [
77
+ "spm_unit_id",
78
+ "spm_unit_weight",
79
+ "snap",
80
+ "tanf",
81
+ "spm_unit_net_income",
82
+ ],
83
+ "tax_unit": [
84
+ "tax_unit_id",
85
+ "tax_unit_weight",
86
+ "income_tax",
87
+ "employee_payroll_tax",
88
+ "eitc",
89
+ "ctc",
90
+ ],
91
+ "household": [
92
+ "household_id",
93
+ "household_weight",
94
+ "household_net_income",
95
+ "household_benefits",
96
+ "household_tax",
97
+ "household_market_income",
98
+ ],
99
+ }
100
+
48
101
  def __init__(self, **kwargs: dict):
49
102
  # Lazy-load package metadata if not provided
50
103
  if "version" not in kwargs or kwargs.get("version") is None:
@@ -156,59 +209,6 @@ class PolicyEngineUSLatest(TaxBenefitModelVersion):
156
209
  )
157
210
  modifier(microsim)
158
211
 
159
- entity_variables = {
160
- "person": [
161
- # IDs and weights
162
- "person_id",
163
- "marital_unit_id",
164
- "family_id",
165
- "spm_unit_id",
166
- "tax_unit_id",
167
- "household_id",
168
- "person_weight",
169
- # Demographics
170
- "age",
171
- # Income
172
- "employment_income",
173
- # Benefits
174
- "ssi",
175
- "social_security",
176
- "medicaid",
177
- "unemployment_compensation",
178
- ],
179
- "marital_unit": [
180
- "marital_unit_id",
181
- "marital_unit_weight",
182
- ],
183
- "family": [
184
- "family_id",
185
- "family_weight",
186
- ],
187
- "spm_unit": [
188
- "spm_unit_id",
189
- "spm_unit_weight",
190
- "snap",
191
- "tanf",
192
- "spm_unit_net_income",
193
- ],
194
- "tax_unit": [
195
- "tax_unit_id",
196
- "tax_unit_weight",
197
- "income_tax",
198
- "employee_payroll_tax",
199
- "eitc",
200
- "ctc",
201
- ],
202
- "household": [
203
- "household_id",
204
- "household_weight",
205
- "household_net_income",
206
- "household_benefits",
207
- "household_tax",
208
- "household_market_income",
209
- ],
210
- }
211
-
212
212
  data = {
213
213
  "person": pd.DataFrame(),
214
214
  "marital_unit": pd.DataFrame(),
@@ -259,7 +259,7 @@ class PolicyEngineUSLatest(TaxBenefitModelVersion):
259
259
  data["person"][target_col] = person_input_df[col].values
260
260
 
261
261
  # Then calculate non-ID, non-weight variables from simulation
262
- for entity, variables in entity_variables.items():
262
+ for entity, variables in self.entity_variables.items():
263
263
  for var in variables:
264
264
  if var not in id_columns and var not in weight_columns:
265
265
  data[entity][var] = microsim.calculate(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: policyengine
3
- Version: 3.1.2
3
+ Version: 3.1.3
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
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