policyengine-uk 2.40.0__py3-none-any.whl → 2.40.2__py3-none-any.whl

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.
@@ -213,12 +213,11 @@ class UKMultiYearDataset:
213
213
 
214
214
  # Check if the file contains datasets for multiple years
215
215
  with h5py.File(file_path, "r") as f:
216
- if not any(key.startswith("/person/") for key in f.keys()):
217
- raise ValueError("No person dataset found in the file.")
218
- if not any(key.startswith("/benunit/") for key in f.keys()):
219
- raise ValueError("No benunit dataset found in the file.")
220
- if not any(key.startswith("/household/") for key in f.keys()):
221
- raise ValueError("No household dataset found in the file.")
216
+ for required_dataset in ["person", "benunit", "household"]:
217
+ if not any(f"{required_dataset}" in key for key in f.keys()):
218
+ raise ValueError(
219
+ f"Dataset '{required_dataset}' not found in the file: {file_path}"
220
+ )
222
221
 
223
222
  def load(self):
224
223
  data = {}
@@ -48,7 +48,9 @@ def apply_single_year_uprating(
48
48
  prev_year_value = getattr(previous_year, table_name)[
49
49
  variable
50
50
  ]
51
- current_year_value = prev_year_value * index_rel_change
51
+ current_year_value = prev_year_value * (
52
+ 1 + index_rel_change
53
+ )
52
54
  getattr(current_year, table_name)[
53
55
  variable
54
56
  ] = current_year_value
@@ -158,11 +160,6 @@ def uprate_rent(
158
160
  private_rent_growth = (
159
161
  aggregate_growth - social_weight * social_rent_growth
160
162
  ) / private_weight
161
- print(
162
- f"Backed out private rent growth: {private_rent_growth:.1%} in {year}"
163
- )
164
- print(f"OBR aggregate rent growth: {aggregate_growth:.1%} in {year}")
165
- print(f"Social rent growth: {social_rent_growth:.1%} in {year}")
166
163
 
167
164
  current_year.household["rent"] = np.where(
168
165
  is_private_rented,
@@ -182,3 +179,6 @@ def reset_uprating(
182
179
  for year in dataset.datasets:
183
180
  if year != first_year:
184
181
  dataset.datasets[year] = dataset.datasets[first_year].copy()
182
+ dataset.datasets[year].time_period = str(year)
183
+
184
+ return dataset
policyengine_uk/system.py CHANGED
@@ -202,9 +202,13 @@ class Microsimulation(CoreMicrosimulation):
202
202
  dataset = UKMultiYearDataset(
203
203
  file_path=dataset_file_path
204
204
  )
205
- except:
205
+ except Exception as e:
206
206
  pass
207
- dataset = Dataset.from_file(dataset_file_path)
207
+
208
+ if not isinstance(
209
+ dataset, (UKSingleYearDataset, UKMultiYearDataset)
210
+ ):
211
+ dataset = Dataset.from_file(dataset_file_path)
208
212
 
209
213
  super().__init__(*args, dataset=dataset, **kwargs)
210
214
 
@@ -4,7 +4,7 @@ reforms:
4
4
  parameters:
5
5
  gov.hmrc.income_tax.rates.uk[0].rate: 0.21
6
6
  - name: Raise higher rate by 1pp
7
- expected_impact: 4.8
7
+ expected_impact: 4.7
8
8
  parameters:
9
9
  gov.hmrc.income_tax.rates.uk[1].rate: 0.42
10
10
  - name: Raise personal allowance by ~800GBP/year
@@ -16,7 +16,7 @@ reforms:
16
16
  parameters:
17
17
  gov.hmrc.child_benefit.amount.additional: 25
18
18
  - name: Reduce Universal Credit taper rate to 20%
19
- expected_impact: -36.5
19
+ expected_impact: -36.6
20
20
  parameters:
21
21
  gov.dwp.universal_credit.means_test.reduction_rate: 0.2
22
22
  - name: Raise Class 1 main employee NICs rate to 10%
@@ -28,6 +28,6 @@ reforms:
28
28
  parameters:
29
29
  gov.hmrc.vat.standard_rate: 0.22
30
30
  - name: Raise additional rate by 3pp
31
- expected_impact: 5.5
31
+ expected_impact: 5.4
32
32
  parameters:
33
33
  gov.hmrc.income_tax.rates.uk[2].rate: 0.48
@@ -5,6 +5,18 @@ 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
+ ## [2.40.2] - 2025-07-22 09:37:07
9
+
10
+ ### Fixed
11
+
12
+ - Bug in uprating.
13
+
14
+ ## [2.40.1] - 2025-07-21 15:37:49
15
+
16
+ ### Fixed
17
+
18
+ - Bug in handling downloads of UKMultiYearDataset from HuggingFace.
19
+
8
20
  ## [2.40.0] - 2025-07-21 13:23:31
9
21
 
10
22
  ### Added
@@ -1974,6 +1986,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1974
1986
 
1975
1987
 
1976
1988
 
1989
+ [2.40.2]: https://github.com/PolicyEngine/openfisca-uk/compare/2.40.1...2.40.2
1990
+ [2.40.1]: https://github.com/PolicyEngine/openfisca-uk/compare/2.40.0...2.40.1
1977
1991
  [2.40.0]: https://github.com/PolicyEngine/openfisca-uk/compare/2.39.3...2.40.0
1978
1992
  [2.39.3]: https://github.com/PolicyEngine/openfisca-uk/compare/2.39.2...2.39.3
1979
1993
  [2.39.2]: https://github.com/PolicyEngine/openfisca-uk/compare/2.39.1...2.39.2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: policyengine-uk
3
- Version: 2.40.0
3
+ Version: 2.40.2
4
4
  Summary: PolicyEngine tax and benefit system for the UK
5
5
  Project-URL: Homepage, https://github.com/PolicyEngine/policyengine-uk
6
6
  Project-URL: Repository, https://github.com/PolicyEngine/policyengine-uk
@@ -3,10 +3,10 @@ policyengine_uk/entities.py,sha256=9yUbkUWQr3WydNE-gHhUudG97HGyXIZY3dkgQ6Z3t9A,1
3
3
  policyengine_uk/model_api.py,sha256=D5OuQpQbdBXiF6r7LvCLWjsTkAWtkeBJWz2ebsJ-GN0,189
4
4
  policyengine_uk/modelled_policies.yaml,sha256=TLhvmkuI9ip-Fjq63n66RzDErCkN8K4BzY6XLxLMtFg,463
5
5
  policyengine_uk/repo.py,sha256=-dqpIMUD7UUj94ql9XwaMrFJUYKvNhFQ_9uj83Z8uh0,55
6
- policyengine_uk/system.py,sha256=wsMtkWDneSTJ2M4UZcBWTjZ-0rRyt2IfTbp255mQ7cM,9550
6
+ policyengine_uk/system.py,sha256=jfMN-0cDBMsbqIgTenRxCblSY3o69YIeSWGFaBgF76s,9719
7
7
  policyengine_uk/data/__init__.py,sha256=J0bZ3WnvPzZ4qfVLYcwOc4lziMUMdbcMqJ3xwjoekbM,101
8
- policyengine_uk/data/dataset_schema.py,sha256=C178v_9OGqx2WXRFfpi3WzdekFuuTB0ulHyTleHB4hM,8357
9
- policyengine_uk/data/economic_assumptions.py,sha256=YOwoY2Id5Zrhvz5hFbjZEc-maPCzNvNgsVD7xXzu5v4,5825
8
+ policyengine_uk/data/dataset_schema.py,sha256=aiBxxEwuYQ5TobkX1U8PM0sQK9c58MGJHnHfL2Aymso,8215
9
+ policyengine_uk/data/economic_assumptions.py,sha256=ZZ0sXqhYKjfCkcMZhutZgnvI3cWqC_wfwWocMWpniso,5697
10
10
  policyengine_uk/data/uprating_indices.yaml,sha256=kQtfeGWyqge4dbJhs0iF4kTMqovuegill_Zfs8orJi4,2394
11
11
  policyengine_uk/parameters/gov/README.md,sha256=bHUep1_2pLHD3Or8SwjStOWXDIbW9OuYxOd4ml8IXcM,13
12
12
  policyengine_uk/parameters/gov/benefit_uprating_cpi.yaml,sha256=2zOSdJeUhDZYYsKE2vLkcK-UbKNoOSVwfac0QIAp02g,250
@@ -528,7 +528,7 @@ policyengine_uk/reforms/policyengine/disable_simulated_benefits.py,sha256=siEs1E
528
528
  policyengine_uk/tests/test_parameter_metadata.py,sha256=_2w2dSokAf5Jskye_KIL8eh80N7yIrUszlmqnZtwQws,450
529
529
  policyengine_uk/tests/code_health/test_variables.py,sha256=9Y-KpmzhyRGy9eEqocK9z91NXHX5QIF3mDMNGvegb7Q,1398
530
530
  policyengine_uk/tests/microsimulation/README.md,sha256=1toB1Z06ynlUielTrsAaeo9Vb-c3ZrB3tbbR4E1xUGk,3924
531
- policyengine_uk/tests/microsimulation/reforms_config.yaml,sha256=lHBXxuYDtpS5oTfpZEv-9E-o-UZiCn7zf824xvQQ4_s,1086
531
+ policyengine_uk/tests/microsimulation/reforms_config.yaml,sha256=xM7x1KxctM0equ4z4kd32bfcMgQC87pNFhF6n0hlYkQ,1086
532
532
  policyengine_uk/tests/microsimulation/test_reform_impacts.py,sha256=xM3M2pclEhA9JIFpnuiPMy1fEBFOKcSzroRPk73FPls,2635
533
533
  policyengine_uk/tests/microsimulation/test_validity.py,sha256=RWhbSKrnrZCNQRVmGYlM8hnpe1_Blo5_xP8vr8u3kV0,694
534
534
  policyengine_uk/tests/microsimulation/update_reform_impacts.py,sha256=2pxp2RNLWxV4CesGKKHmg3qBs79Jq2Jcq3GJIBk4euU,4824
@@ -1367,10 +1367,10 @@ policyengine_uk/variables/misc/spi_imputed.py,sha256=iPVlBF_TisM0rtKvO-3-PQ2UYCe
1367
1367
  policyengine_uk/variables/misc/uc_migrated.py,sha256=zFNcUJaO8gwmbL1iY9GKgUt3G6J9yrCraqBV_5dCvlM,306
1368
1368
  policyengine_uk/variables/misc/categories/lower_middle_or_higher.py,sha256=C54tHYz2DmOyvQYCC1bF8RJwRZinhAq_e3aYC-9F5fM,157
1369
1369
  policyengine_uk/variables/misc/categories/lower_or_higher.py,sha256=81NIbLLabRr9NwjpUZDuV8IV8_mqmp5NM-CZvt55TwE,129
1370
- policyengine_uk-2.40.0.data/data/share/openfisca/openfisca-country-template/CHANGELOG.md,sha256=2G0rtwRDXgWe4UU8Fkg_BOscYoCOzL0seIj5y3dr7JA,57061
1371
- policyengine_uk-2.40.0.data/data/share/openfisca/openfisca-country-template/LICENSE,sha256=dql8h4yceoMhuzlcK0TT_i-NgTFNIZsgE47Q4t3dUYI,34520
1372
- policyengine_uk-2.40.0.data/data/share/openfisca/openfisca-country-template/README.md,sha256=PCy7LRLdUDQS8U4PaeHeBVnyBZAqHv1dAVDDvEcom20,1976
1373
- policyengine_uk-2.40.0.dist-info/METADATA,sha256=zjGj02SFc6sRVUcXo3SjQpYAcXpt8fiOSs6xO3DR58I,3502
1374
- policyengine_uk-2.40.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
1375
- policyengine_uk-2.40.0.dist-info/licenses/LICENSE,sha256=dql8h4yceoMhuzlcK0TT_i-NgTFNIZsgE47Q4t3dUYI,34520
1376
- policyengine_uk-2.40.0.dist-info/RECORD,,
1370
+ policyengine_uk-2.40.2.data/data/share/openfisca/openfisca-country-template/CHANGELOG.md,sha256=f_pHmbpczLD3yYXk88xFa8hOqd01GrFTDn9qj6e7PLg,57400
1371
+ policyengine_uk-2.40.2.data/data/share/openfisca/openfisca-country-template/LICENSE,sha256=dql8h4yceoMhuzlcK0TT_i-NgTFNIZsgE47Q4t3dUYI,34520
1372
+ policyengine_uk-2.40.2.data/data/share/openfisca/openfisca-country-template/README.md,sha256=PCy7LRLdUDQS8U4PaeHeBVnyBZAqHv1dAVDDvEcom20,1976
1373
+ policyengine_uk-2.40.2.dist-info/METADATA,sha256=6IU84cfFQfAsM7MNkdL-dG384DSMB-EnbGgmB0UGSwg,3502
1374
+ policyengine_uk-2.40.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
1375
+ policyengine_uk-2.40.2.dist-info/licenses/LICENSE,sha256=dql8h4yceoMhuzlcK0TT_i-NgTFNIZsgE47Q4t3dUYI,34520
1376
+ policyengine_uk-2.40.2.dist-info/RECORD,,