From f40b63e577ea3f4967510262d1a533707caf98a0 Mon Sep 17 00:00:00 2001 From: Nikhil Woodruff <35577657+nikhilwoodruff@users.noreply.github.com> Date: Tue, 16 Apr 2024 14:18:31 +0100 Subject: [PATCH] Assorted fixes (#845) * Fix Remove unnecessary `baseline` parameter node #844 and Original FRS simulations error due to no corporate wealth #843 * Remove docker build action for now --- .github/workflows/pr.yml | 14 -------------- .github/workflows/push.yml | 19 ------------------- changelog_entry.yaml | 5 +++++ policyengine_uk/system.py | 1 - .../variables/household/wealth/corporate.py | 5 ++++- setup.py | 2 +- 6 files changed, 10 insertions(+), 36 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 24daa5758..8f1206898 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -57,17 +57,3 @@ jobs: run: make documentation env: POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN: ${{ secrets.POLICYENGINE_GITHUB_MICRODATA_AUTH_TOKEN}} - Docker: - name: Docker - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v3 - - name: Log in to the Container registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build container - run: docker build docs/streamlit -t ghcr.io/policyengine/policyengine-uk-documentation diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 26c33836b..3c93efa49 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -79,25 +79,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} BRANCH: gh-pages # The branch the action should deploy to. FOLDER: docs/book/_build/html # The folder the action should deploy. - Docker: - if: | - (github.repository == 'PolicyEngine/policyengine-uk') - && (github.event.head_commit.message == 'Update PolicyEngine UK') - name: Docker - runs-on: ubuntu-latest - steps: - - name: Checkout repo - uses: actions/checkout@v3 - - name: Log in to the Container registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Build container - run: docker build docs/streamlit -t ghcr.io/policyengine/policyengine-uk-documentation - - name: Push container - run: docker push ghcr.io/policyengine/policyengine-uk-documentation Publish: if: | (github.repository == 'PolicyEngine/policyengine-uk') diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29bb..315ac646d 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,5 @@ +- bump: patch + changes: + fixed: + - Bug causing frs_2021 simulations to error. + - Unnecessary system initialisation code. diff --git a/policyengine_uk/system.py b/policyengine_uk/system.py index 2c653f738..2eb89220e 100644 --- a/policyengine_uk/system.py +++ b/policyengine_uk/system.py @@ -37,7 +37,6 @@ class CountryTaxBenefitSystem(TaxBenefitSystem): def __init__(self, reform=None): super().__init__(entities, reform=reform) - self.parameters.add_child("baseline", self.parameters.clone()) self.parameters = backdate_parameters(self.parameters, "2021-01-01") diff --git a/policyengine_uk/variables/household/wealth/corporate.py b/policyengine_uk/variables/household/wealth/corporate.py index 3b8c0358d..da826a4ea 100644 --- a/policyengine_uk/variables/household/wealth/corporate.py +++ b/policyengine_uk/variables/household/wealth/corporate.py @@ -11,7 +11,10 @@ class shareholding(Variable): def formula(household, period, parameters): wealth = household("corporate_wealth", period) - if hasattr(household.simulation, "dataset"): + if ( + hasattr(household.simulation, "dataset") + and household("corporate_wealth", period).sum() != 0 + ): weight = household("household_weight", period) return wealth / (wealth * weight).sum() wealth = parameters(period).household.wealth diff --git a/setup.py b/setup.py index c90bab0a9..da77861b7 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ "microdf_python>=0.3.0", "pandas", "plotly>=4.14.3", - "PolicyEngine-Core>=2.11.3,<3", + "PolicyEngine-Core>=2.19.0,<3", "pyyaml>=5.3.1", "pytest", "requests>=2.25.1",