policyengine-uk 2.54.1__py3-none-any.whl → 2.54.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.

Potentially problematic release.


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

@@ -9,6 +9,7 @@ import logging
9
9
 
10
10
  def extend_single_year_dataset(
11
11
  dataset: UKSingleYearDataset,
12
+ tax_benefit_system_parameters: ParameterNode,
12
13
  end_year: int = 2030,
13
14
  ) -> UKMultiYearDataset:
14
15
  # Extend years and uprate
@@ -19,11 +20,15 @@ def extend_single_year_dataset(
19
20
  next_year.time_period = str(year)
20
21
  datasets.append(next_year)
21
22
  multi_year_dataset = UKMultiYearDataset(datasets=datasets)
22
- return apply_uprating(multi_year_dataset)
23
+ return apply_uprating(
24
+ multi_year_dataset,
25
+ tax_benefit_system_parameters=tax_benefit_system_parameters,
26
+ )
23
27
 
24
28
 
25
29
  def apply_uprating(
26
30
  dataset: UKMultiYearDataset,
31
+ tax_benefit_system_parameters: ParameterNode = None,
27
32
  ):
28
33
  from policyengine_uk.system import system
29
34
 
@@ -38,7 +43,9 @@ def apply_uprating(
38
43
  continue # Don't uprate the first year
39
44
  current_year = dataset.datasets[year]
40
45
  prev_year = dataset.datasets[year - 1]
41
- apply_single_year_uprating(current_year, prev_year, system.parameters)
46
+ apply_single_year_uprating(
47
+ current_year, prev_year, tax_benefit_system_parameters
48
+ )
42
49
 
43
50
  return dataset
44
51
 
@@ -84,6 +84,12 @@ class Simulation(CoreSimulation):
84
84
 
85
85
  self.branches: Dict[str, Simulation] = {}
86
86
 
87
+ if scenario is not None:
88
+ if scenario.parameter_changes is not None:
89
+ self.apply_parameter_changes(scenario.parameter_changes)
90
+ if scenario.simulation_modifier is not None:
91
+ scenario.simulation_modifier(self)
92
+
87
93
  # Build simulation from appropriate source
88
94
  if situation is not None:
89
95
  self.build_from_situation(situation)
@@ -129,12 +135,6 @@ class Simulation(CoreSimulation):
129
135
  else:
130
136
  self.baseline = self.clone()
131
137
 
132
- if scenario is not None:
133
- if scenario.parameter_changes is not None:
134
- self.apply_parameter_changes(scenario.parameter_changes)
135
- if scenario.simulation_modifier is not None:
136
- scenario.simulation_modifier(self)
137
-
138
138
  self.calculated_periods = []
139
139
 
140
140
  def reset_calculations(self):
@@ -321,7 +321,9 @@ class Simulation(CoreSimulation):
321
321
  dataset = UKSingleYearDataset.from_simulation(
322
322
  self, fiscal_year=first_time_period
323
323
  )
324
- multi_year_dataset = extend_single_year_dataset(dataset)
324
+ multi_year_dataset = extend_single_year_dataset(
325
+ dataset, self.tax_benefit_system.parameters
326
+ )
325
327
 
326
328
  self.build_from_multi_year_dataset(multi_year_dataset)
327
329
  self.dataset = multi_year_dataset
@@ -335,7 +337,9 @@ class Simulation(CoreSimulation):
335
337
  dataset: UKSingleYearDataset containing one year of data
336
338
  """
337
339
 
338
- dataset = extend_single_year_dataset(dataset)
340
+ dataset = extend_single_year_dataset(
341
+ dataset, self.tax_benefit_system.parameters
342
+ )
339
343
  self.build_from_multi_year_dataset(dataset)
340
344
  self.dataset = dataset
341
345
 
@@ -0,0 +1,12 @@
1
+ from policyengine_uk.model_api import *
2
+
3
+
4
+ class post_tax_income(Variable):
5
+ label = "post-tax income"
6
+ documentation = "The income of a household after taxes have been deducted."
7
+ entity = Household
8
+ definition_period = YEAR
9
+ value_type = float
10
+ unit = GBP
11
+ adds = ["total_income"]
12
+ subtracts = ["income_tax", "national_insurance"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: policyengine-uk
3
- Version: 2.54.1
3
+ Version: 2.54.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,12 +3,12 @@ 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=YR8mxP6D5wSQGdCo2nLO0Jq6isNv5U83ddusVMnoOZk,21265
6
+ policyengine_uk/simulation.py,sha256=0FRttWoO05aTG7qvsJ5-mALEgxDHFCVRh28kwKP0XUY,21381
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=fF3Qhm01PCx26pbG_WRKddacNzbgbuEoayV_xMETDgc,144
10
10
  policyengine_uk/data/dataset_schema.py,sha256=781beGVnPWJhw2FzcG6he-LtmgxtwS1h6keAz7TPoXI,10036
11
- policyengine_uk/data/economic_assumptions.py,sha256=U3wyBs4zVI5-bcMB-GivELC1qG-895l5NPds3cuWb90,6239
11
+ policyengine_uk/data/economic_assumptions.py,sha256=rb4Utj5bHQhIXfz-eSLvluvyZXECvF_cWtag_sefr0s,6464
12
12
  policyengine_uk/data/filter_dataset.py,sha256=DtIixUMRnY-g-acXZIxaZ5217NYYVAMxVgs1Wa3rya0,1622
13
13
  policyengine_uk/data/uprating_indices.yaml,sha256=kQtfeGWyqge4dbJhs0iF4kTMqovuegill_Zfs8orJi4,2394
14
14
  policyengine_uk/dynamics/labour_supply.py,sha256=MQnlp2OfD2RboqBOxKoLHzVKfZjP04j6Oif1Jswp1-w,12074
@@ -1138,6 +1138,7 @@ policyengine_uk/variables/household/cliff_evaluated.py,sha256=UfQ3GYys2L61PyAMWr
1138
1138
  policyengine_uk/variables/household/cliff_gap.py,sha256=jZmKoLjJYAojwUEF4cfu4wvfaeN_tMYFhpRYdVk1_Vs,498
1139
1139
  policyengine_uk/variables/household/is_on_cliff.py,sha256=MmRHX9pxnzUKGgPw2F_5dSlLv8NjSQOvcH9Z4r6-MQM,392
1140
1140
  policyengine_uk/variables/household/marginal_tax_rate.py,sha256=hK41cSc9i4QAnGBLqUViwTiw3BsQPtfsO3jjvRfjhPE,2001
1141
+ policyengine_uk/variables/household/post_tax_income.py,sha256=YP4fL_hHdOK1LXQ9huqfPiCewfQWd0RKpwJgRRLKweY,356
1141
1142
  policyengine_uk/variables/household/region.py,sha256=swhjOMUg_crfDi4oEcJY7GoaiNQXfMsyDnJPAmMjp5U,456
1142
1143
  policyengine_uk/variables/household/benefits/employment_benefits.py,sha256=Q3vdJv6MOTv4pIQkyOYhrfyztKV7t6kEAqIYssUNZw8,262
1143
1144
  policyengine_uk/variables/household/consumption/additional_residential_property_purchased.py,sha256=lUd5VjLB2jysui8RuLEJCC4C4Yx0zDXlpybLUEUHuiU,742
@@ -1391,7 +1392,7 @@ policyengine_uk/variables/misc/spi_imputed.py,sha256=iPVlBF_TisM0rtKvO-3-PQ2UYCe
1391
1392
  policyengine_uk/variables/misc/uc_migrated.py,sha256=zFNcUJaO8gwmbL1iY9GKgUt3G6J9yrCraqBV_5dCvlM,306
1392
1393
  policyengine_uk/variables/misc/categories/lower_middle_or_higher.py,sha256=C54tHYz2DmOyvQYCC1bF8RJwRZinhAq_e3aYC-9F5fM,157
1393
1394
  policyengine_uk/variables/misc/categories/lower_or_higher.py,sha256=81NIbLLabRr9NwjpUZDuV8IV8_mqmp5NM-CZvt55TwE,129
1394
- policyengine_uk-2.54.1.dist-info/METADATA,sha256=1kOpL7EC6aBugy0R27XQ2QpqSzowUF_40vBNSp-sh3c,3995
1395
- policyengine_uk-2.54.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
1396
- policyengine_uk-2.54.1.dist-info/licenses/LICENSE,sha256=dql8h4yceoMhuzlcK0TT_i-NgTFNIZsgE47Q4t3dUYI,34520
1397
- policyengine_uk-2.54.1.dist-info/RECORD,,
1395
+ policyengine_uk-2.54.2.dist-info/METADATA,sha256=fDm5iuKgOdR8MdztQR6bxpBeKupSVTzNqi0hUNlw0SA,3995
1396
+ policyengine_uk-2.54.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
1397
+ policyengine_uk-2.54.2.dist-info/licenses/LICENSE,sha256=dql8h4yceoMhuzlcK0TT_i-NgTFNIZsgE47Q4t3dUYI,34520
1398
+ policyengine_uk-2.54.2.dist-info/RECORD,,