policyengine-uk 2.47.2__py3-none-any.whl → 2.47.4__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.

Potentially problematic release.


This version of policyengine-uk might be problematic. Click here for more details.

@@ -122,6 +122,9 @@ class Simulation(CoreSimulation):
122
122
 
123
123
  self.tax_benefit_system.reset_parameter_caches()
124
124
 
125
+ self.move_values("capital_gains", "capital_gains_before_response")
126
+ self.move_values("employment_income", "employment_income_before_lsr")
127
+
125
128
  if scenario is not None:
126
129
  if scenario.simulation_modifier is not None:
127
130
  scenario.simulation_modifier(self)
@@ -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: -33.8
19
+ expected_impact: -33.7
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%
@@ -2,6 +2,7 @@ from pydantic import BaseModel
2
2
  from typing import Optional, Callable, Dict, Type, Union
3
3
  from policyengine_core.simulations import Simulation
4
4
  from policyengine_core.reforms import Reform
5
+ from policyengine_core.periods import period, instant
5
6
 
6
7
 
7
8
  class Scenario(BaseModel):
@@ -111,8 +112,42 @@ class Scenario(BaseModel):
111
112
 
112
113
  elif isinstance(reform, dict):
113
114
  # Dictionary of parameter changes
114
- return cls(
115
- parameter_changes=reform,
115
+ # Make sure to capture YYYY-MM-DD.YYYY-MM-DD.
116
+
117
+ def modifier(sim: Simulation):
118
+ for parameter in reform:
119
+ if isinstance(reform[parameter], dict):
120
+ for period_str, value in reform[parameter].items():
121
+ if "." in period_str:
122
+ start = instant(period_str.split(".")[0])
123
+ stop = instant(period_str.split(".")[1])
124
+ period_ = None
125
+ else:
126
+ period_ = period(period_str)
127
+ sim.tax_benefit_system.parameters.get_child(
128
+ parameter
129
+ ).update(
130
+ start=start,
131
+ stop=stop,
132
+ period=period_,
133
+ value=value,
134
+ )
135
+ else:
136
+ start = instant("2023-01-01")
137
+ stop = None
138
+ period_ = None
139
+
140
+ sim.tax_benefit_system.parameters.get_child(
141
+ parameter
142
+ ).update(
143
+ start=start,
144
+ stop=stop,
145
+ period=period_,
146
+ value=reform[parameter],
147
+ )
148
+
149
+ return Scenario(
150
+ simulation_modifier=modifier,
116
151
  )
117
152
 
118
153
  elif isinstance(reform, tuple):
@@ -26,7 +26,6 @@ class gov_tax(Variable):
26
26
  "national_insurance",
27
27
  "LVT",
28
28
  "carbon_tax",
29
- "vat_change",
30
29
  "capital_gains_tax",
31
30
  "private_school_vat",
32
31
  "corporate_incident_tax_revenue_change",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: policyengine-uk
3
- Version: 2.47.2
3
+ Version: 2.47.4
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,7 +3,7 @@ policyengine_uk/entities.py,sha256=9yUbkUWQr3WydNE-gHhUudG97HGyXIZY3dkgQ6Z3t9A,1
3
3
  policyengine_uk/microsimulation.py,sha256=WskrrDrLGfDYwS1CzFk5rJkQSQlTknLkxFufStKRpxc,3379
4
4
  policyengine_uk/model_api.py,sha256=KdwJCL2HkXVxDpL6fCsCnQ9Sub6Kqp7Hyxlis3MNIx4,241
5
5
  policyengine_uk/modelled_policies.yaml,sha256=TLhvmkuI9ip-Fjq63n66RzDErCkN8K4BzY6XLxLMtFg,463
6
- policyengine_uk/simulation.py,sha256=GaN8ZC7bZVTRzP7Np-PfUiX60F6dKszdTrNhXe_OLuU,21186
6
+ policyengine_uk/simulation.py,sha256=P8QtdBI4gCrXJR0rchybLKhXHKAzEnLedE7_gxy3520,21340
7
7
  policyengine_uk/system.py,sha256=Z-ax_ImUq5k4tycuThczTxQNW5iTE6ikBJIBQdKfIzU,91
8
8
  policyengine_uk/tax_benefit_system.py,sha256=CjX1lERyOm_vlgHQcQO92HZtJiwItLH-MxJveJqk6iM,5165
9
9
  policyengine_uk/data/__init__.py,sha256=J0bZ3WnvPzZ4qfVLYcwOc4lziMUMdbcMqJ3xwjoekbM,101
@@ -543,7 +543,7 @@ policyengine_uk/scenarios/uc_reform.py,sha256=WPYKGBY_V7A0pQPxDM0lOYTR9GoLrF-iEm
543
543
  policyengine_uk/tests/test_parameter_metadata.py,sha256=_2w2dSokAf5Jskye_KIL8eh80N7yIrUszlmqnZtwQws,450
544
544
  policyengine_uk/tests/code_health/test_variables.py,sha256=9Y-KpmzhyRGy9eEqocK9z91NXHX5QIF3mDMNGvegb7Q,1398
545
545
  policyengine_uk/tests/microsimulation/README.md,sha256=1toB1Z06ynlUielTrsAaeo9Vb-c3ZrB3tbbR4E1xUGk,3924
546
- policyengine_uk/tests/microsimulation/reforms_config.yaml,sha256=Kh1WlLAEmYbYgpiyrfD7VkT0oMf8a9lsCHLAa8mGuKY,1086
546
+ policyengine_uk/tests/microsimulation/reforms_config.yaml,sha256=A2CdqmZikOA5a1pt8ZLTaR9GXCR__Yut0AxiUby2LlQ,1086
547
547
  policyengine_uk/tests/microsimulation/test_reform_impacts.py,sha256=xM3M2pclEhA9JIFpnuiPMy1fEBFOKcSzroRPk73FPls,2635
548
548
  policyengine_uk/tests/microsimulation/test_validity.py,sha256=_mHgrNu-hKzVd9V2GSg_yPQgJctxRzdQM7lM2bUvqNY,636
549
549
  policyengine_uk/tests/microsimulation/update_reform_impacts.py,sha256=4m5EpPu4SXTE3qOPkx3eIZnlaOzprfm6GmMCXETZuLk,6890
@@ -703,7 +703,7 @@ policyengine_uk/utils/create_ahc_deflator.py,sha256=7GvhywFiUMSsh0syBd-A2MVBr-HU
703
703
  policyengine_uk/utils/create_triple_lock.py,sha256=-LpKwztjcDaNYd3RpnMiwxAm48RWsvw0NY9wG6gXIYw,952
704
704
  policyengine_uk/utils/dependencies.py,sha256=8epKWmZBeHnxqh3j0sb-Wl3Of_OdKNX-p1syLowUcWs,8197
705
705
  policyengine_uk/utils/parameters.py,sha256=OQTzTkHMdwbphCo0mV7_n_FJT0rdwIKNFTsk_lsdETE,1301
706
- policyengine_uk/utils/scenario.py,sha256=snA0HNfHqMQGjB35vo0hns4dPduCImGPvlGVAXxx85M,6751
706
+ policyengine_uk/utils/scenario.py,sha256=07PNZhrAi9eb4EgvtGX1wHrj6GPbwd__8AXwY2WeeW4,8297
707
707
  policyengine_uk/utils/solve_private_school_attendance_factor.py,sha256=RIpxsT6OKhLlNCX5ielTRr2ZkPQOfPpg9AbP062iWh4,1555
708
708
  policyengine_uk/utils/water/README.md,sha256=sdBI-JZ-jcRoSUfwNx5wjv5Ig_nM8OPvvjSsSMs_Wh8,443
709
709
  policyengine_uk/utils/water/forecast_water_bills.py,sha256=B4vtfJuR8XfBP-KHGyhRp2Oo7X7buN-lDH6tBIXqE2U,2788
@@ -736,7 +736,7 @@ policyengine_uk/variables/contrib/ubi_center/basic_income/bi_maximum.py,sha256=N
736
736
  policyengine_uk/variables/contrib/ubi_center/basic_income/bi_phaseout.py,sha256=CcTdVg4KABnB8Uj0DpiO4wXfpUsRMGn1aHgoQqxBCaI,259
737
737
  policyengine_uk/variables/gov/gov_balance.py,sha256=fNo-e-Nc3SIVAoCQR0VUMKj3-qre9IpYcfz-KEYkQ5w,328
738
738
  policyengine_uk/variables/gov/gov_spending.py,sha256=VWWnDaCWuyIUmxvAjiD7gwrk-TwK63j9ZcLiFRw-8dI,1382
739
- policyengine_uk/variables/gov/gov_tax.py,sha256=on7t0SwteBvxp4JF1_sTIzDxbjVvCLMGaprxxBbLy3E,1299
739
+ policyengine_uk/variables/gov/gov_tax.py,sha256=yupX06QE43eeEtKnFHYMVXZfdbfaCLzZGz99C-l0SV4,1277
740
740
  policyengine_uk/variables/gov/dcms/bbc/tv_licence/free_tv_licence_value.py,sha256=3W9zi4rnq5-HAPBHr_DLZHlyMVHs5TL3ZhB0GdfDTyM,710
741
741
  policyengine_uk/variables/gov/dcms/bbc/tv_licence/tv_licence.py,sha256=kHCMt8s6EQjzFN3AZUw05HwJf4GFJDjJQzsVYKCe2QY,689
742
742
  policyengine_uk/variables/gov/dcms/bbc/tv_licence/tv_licence_discount.py,sha256=h-zV_TtYl2hMKmilq-QK_hci0C66k4_gnhk2IAyLbI8,1233
@@ -1386,7 +1386,7 @@ policyengine_uk/variables/misc/spi_imputed.py,sha256=iPVlBF_TisM0rtKvO-3-PQ2UYCe
1386
1386
  policyengine_uk/variables/misc/uc_migrated.py,sha256=zFNcUJaO8gwmbL1iY9GKgUt3G6J9yrCraqBV_5dCvlM,306
1387
1387
  policyengine_uk/variables/misc/categories/lower_middle_or_higher.py,sha256=C54tHYz2DmOyvQYCC1bF8RJwRZinhAq_e3aYC-9F5fM,157
1388
1388
  policyengine_uk/variables/misc/categories/lower_or_higher.py,sha256=81NIbLLabRr9NwjpUZDuV8IV8_mqmp5NM-CZvt55TwE,129
1389
- policyengine_uk-2.47.2.dist-info/METADATA,sha256=iKd-_31YEGeJA1CqRvD2CWN_36SR840qoYoPvFTLnrk,3965
1390
- policyengine_uk-2.47.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
1391
- policyengine_uk-2.47.2.dist-info/licenses/LICENSE,sha256=dql8h4yceoMhuzlcK0TT_i-NgTFNIZsgE47Q4t3dUYI,34520
1392
- policyengine_uk-2.47.2.dist-info/RECORD,,
1389
+ policyengine_uk-2.47.4.dist-info/METADATA,sha256=TD7QeaFBcv-hsZ7XOiNddJw5YVCb_-wgfz2AvhZafIY,3965
1390
+ policyengine_uk-2.47.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
1391
+ policyengine_uk-2.47.4.dist-info/licenses/LICENSE,sha256=dql8h4yceoMhuzlcK0TT_i-NgTFNIZsgE47Q4t3dUYI,34520
1392
+ policyengine_uk-2.47.4.dist-info/RECORD,,