From 95a017253d53c777499b2aac568302b5b6b7ee7a Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Tue, 22 Jul 2025 17:53:48 -0400 Subject: [PATCH 01/10] Add Python 3.13 support - Update GitHub Actions workflows to test on Python 3.13 - Python 3.13 classifiers already present in pyproject.toml --- .github/workflows/code_changes.yaml | 2 +- .github/workflows/pr_code_changes.yaml | 2 +- changelog_entry.yaml | 4 ++++ pyproject.toml | 4 ++++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/code_changes.yaml b/.github/workflows/code_changes.yaml index 21c6815b1..c5c9a4e18 100644 --- a/.github/workflows/code_changes.yaml +++ b/.github/workflows/code_changes.yaml @@ -34,7 +34,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: '3.12' + python-version: '3.13' - uses: "google-github-actions/auth@v2" with: workload_identity_provider: "projects/322898545428/locations/global/workloadIdentityPools/policyengine-research-id-pool/providers/prod-github-provider" diff --git a/.github/workflows/pr_code_changes.yaml b/.github/workflows/pr_code_changes.yaml index ffac44323..2f3e0a7e9 100644 --- a/.github/workflows/pr_code_changes.yaml +++ b/.github/workflows/pr_code_changes.yaml @@ -34,7 +34,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: '3.11' + python-version: '3.13' - uses: "google-github-actions/auth@v2" with: workload_identity_provider: "projects/322898545428/locations/global/workloadIdentityPools/policyengine-research-id-pool/providers/prod-github-provider" diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29bb..60542d455 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: patch + changes: + changed: + - Add Python 3.13 support and update CI workflows \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index eda569389..ed499ee4c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,6 +16,10 @@ classifiers = [ "License :: OSI Approved :: GNU Affero General Public License v3", "Operating System :: POSIX", "Programming Language :: Python", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", "Topic :: Scientific/Engineering :: Information Analysis", ] requires-python = ">=3.10" From 0cda4f2432c87204262568bebab59e06166d857a Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Tue, 22 Jul 2025 22:09:51 -0400 Subject: [PATCH 02/10] Update policyengine-core dependency and fix CI for Python 3.13 - Bump policyengine-core to >=3.19.0 for Python 3.13 support - Update all GitHub Actions to latest versions (checkout@v4, setup-python@v5) - Set all workflows to use Python 3.13 - These updates should fix the CI failures related to Python 3.13 compatibility --- .github/workflows/code_changes.yaml | 6 +++--- .github/workflows/docs_changes.yaml | 6 +++--- .github/workflows/pr_code_changes.yaml | 6 +++--- .github/workflows/pr_docs_changes.yaml | 6 +++--- .github/workflows/versioning.yaml | 6 +++--- changelog_entry.yaml | 5 ++++- pyproject.toml | 2 +- 7 files changed, 20 insertions(+), 17 deletions(-) diff --git a/.github/workflows/code_changes.yaml b/.github/workflows/code_changes.yaml index c5c9a4e18..66afc74c5 100644 --- a/.github/workflows/code_changes.yaml +++ b/.github/workflows/code_changes.yaml @@ -27,12 +27,12 @@ jobs: id-token: "write" steps: - name: Checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v5 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.13' - uses: "google-github-actions/auth@v2" @@ -51,7 +51,7 @@ jobs: env: HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }} - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: file: ./coverage.xml fail_ci_if_error: false diff --git a/.github/workflows/docs_changes.yaml b/.github/workflows/docs_changes.yaml index ac362263f..87d69f9e8 100644 --- a/.github/workflows/docs_changes.yaml +++ b/.github/workflows/docs_changes.yaml @@ -15,14 +15,14 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v5 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.13' - name: Install package run: uv pip install -e .[dev] --system diff --git a/.github/workflows/pr_code_changes.yaml b/.github/workflows/pr_code_changes.yaml index 2f3e0a7e9..45a640d08 100644 --- a/.github/workflows/pr_code_changes.yaml +++ b/.github/workflows/pr_code_changes.yaml @@ -27,12 +27,12 @@ jobs: id-token: "write" steps: - name: Checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v5 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.13' - uses: "google-github-actions/auth@v2" @@ -51,7 +51,7 @@ jobs: env: HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }} - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: file: ./coverage.xml fail_ci_if_error: false diff --git a/.github/workflows/pr_docs_changes.yaml b/.github/workflows/pr_docs_changes.yaml index b30680950..150c8b41c 100644 --- a/.github/workflows/pr_docs_changes.yaml +++ b/.github/workflows/pr_docs_changes.yaml @@ -16,14 +16,14 @@ jobs: name: Test documentation builds steps: - name: Checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v5 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.13' - name: Install package run: uv pip install -e .[dev] --system diff --git a/.github/workflows/versioning.yaml b/.github/workflows/versioning.yaml index 17de037dc..1b9011b27 100644 --- a/.github/workflows/versioning.yaml +++ b/.github/workflows/versioning.yaml @@ -41,14 +41,14 @@ jobs: GH_TOKEN: ${{ secrets.POLICYENGINE_GITHUB }} steps: - name: Checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install uv uses: astral-sh/setup-uv@v5 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: '3.12' + python-version: '3.13' - name: Install package run: uv pip install -e .[dev] --system - name: Install policyengine diff --git a/changelog_entry.yaml b/changelog_entry.yaml index 60542d455..0d1682e39 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -1,4 +1,7 @@ - bump: patch changes: changed: - - Add Python 3.13 support and update CI workflows \ No newline at end of file + - Add Python 3.13 support and update CI workflows + - Updated policyengine-core dependency to >=3.19.0 for Python 3.13 support + - Updated GitHub Actions to latest versions (checkout@v4, setup-python@v5) for Python 3.13 compatibility + - Set all workflows to use Python 3.13 \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index ed499ee4c..3b9cc47a4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ classifiers = [ ] requires-python = ">=3.10" dependencies = [ - "policyengine-core>=3.6.4", + "policyengine-core>=3.19.0", "microdf-python>=1.0.0", ] From c152f115ea53b083459a81932b04b816597cee1b Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Tue, 22 Jul 2025 22:33:25 -0400 Subject: [PATCH 03/10] Remove unused tables dependency The tables (PyTables) package is not actually used anywhere in the policyengine-uk codebase and was causing CI failures with Python 3.13. Removing it should allow tests to pass. --- changelog_entry.yaml | 4 +++- pyproject.toml | 4 +--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/changelog_entry.yaml b/changelog_entry.yaml index 0d1682e39..8b1f11147 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -4,4 +4,6 @@ - Add Python 3.13 support and update CI workflows - Updated policyengine-core dependency to >=3.19.0 for Python 3.13 support - Updated GitHub Actions to latest versions (checkout@v4, setup-python@v5) for Python 3.13 compatibility - - Set all workflows to use Python 3.13 \ No newline at end of file + - Set all workflows to use Python 3.13 + removed: + - Removed unused tables dependency that was blocking Python 3.13 compatibility \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 3b9cc47a4..6445f8e2f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,9 +56,7 @@ packages = ["policyengine_uk"] "README.md" = "share/openfisca/openfisca-country-template/README.md" [dependency-groups] -dev = [ - "tables>=3.10.1", -] +dev = [] [project.optional-dependencies] dev = [ From adf252eefbee70eb6223031b6c28bf05ce186bac Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sat, 26 Jul 2025 09:41:01 -0400 Subject: [PATCH 04/10] Update dependencies: policyengine-core to 3.19.3, microdf-python to 1.0.2 --- pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6445f8e2f..75274b670 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,8 +24,8 @@ classifiers = [ ] requires-python = ">=3.10" dependencies = [ - "policyengine-core>=3.19.0", - "microdf-python>=1.0.0", + "policyengine-core>=3.19.3", + "microdf-python>=1.0.2", ] [project.urls] From 6ed58e3701ee90314dfd4a9fdb4a3e5cac17f0ce Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sat, 26 Jul 2025 09:52:54 -0400 Subject: [PATCH 05/10] Fix Python 3.13 deprecation warnings for bitwise operations on booleans Replace ~bool with (not bool) for parameter values to avoid Python 3.13 deprecation warnings --- policyengine_uk/variables/gov/dwp/winter_fuel_allowance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/policyengine_uk/variables/gov/dwp/winter_fuel_allowance.py b/policyengine_uk/variables/gov/dwp/winter_fuel_allowance.py index b478320cd..1308b28bc 100644 --- a/policyengine_uk/variables/gov/dwp/winter_fuel_allowance.py +++ b/policyengine_uk/variables/gov/dwp/winter_fuel_allowance.py @@ -45,11 +45,11 @@ def formula(household, period, parameters): ) meets_mtb_requirement = ( - on_mtb | ~wfp.eligibility.require_benefits | meets_income_passport + on_mtb | (not wfp.eligibility.require_benefits) | meets_income_passport ) meets_spa_requirement = ( household.any(is_SP_age) - | ~wfp.eligibility.state_pension_age_requirement + | (not wfp.eligibility.state_pension_age_requirement) ) meets_higher_age_requirement = household.any( age >= wfp.eligibility.higher_age_requirement From f13e1f972a18fa5a0503f15e09e2b189b758e7be Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sat, 26 Jul 2025 09:54:42 -0400 Subject: [PATCH 06/10] Fix formatting --- .../variables/gov/dwp/winter_fuel_allowance.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/policyengine_uk/variables/gov/dwp/winter_fuel_allowance.py b/policyengine_uk/variables/gov/dwp/winter_fuel_allowance.py index 1308b28bc..0c23d68e7 100644 --- a/policyengine_uk/variables/gov/dwp/winter_fuel_allowance.py +++ b/policyengine_uk/variables/gov/dwp/winter_fuel_allowance.py @@ -45,11 +45,12 @@ def formula(household, period, parameters): ) meets_mtb_requirement = ( - on_mtb | (not wfp.eligibility.require_benefits) | meets_income_passport + on_mtb + | (not wfp.eligibility.require_benefits) + | meets_income_passport ) - meets_spa_requirement = ( - household.any(is_SP_age) - | (not wfp.eligibility.state_pension_age_requirement) + meets_spa_requirement = household.any(is_SP_age) | ( + not wfp.eligibility.state_pension_age_requirement ) meets_higher_age_requirement = household.any( age >= wfp.eligibility.higher_age_requirement From db0efd37e8c1ffad2851c5772ca6a7169f36976c Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sat, 26 Jul 2025 09:57:30 -0400 Subject: [PATCH 07/10] Remove redundant dependency-groups section The dev dependencies are already defined in project.optional-dependencies --- pyproject.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 75274b670..3cacdfc53 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,9 +55,6 @@ packages = ["policyengine_uk"] "LICENSE" = "share/openfisca/openfisca-country-template/LICENSE" "README.md" = "share/openfisca/openfisca-country-template/README.md" -[dependency-groups] -dev = [] - [project.optional-dependencies] dev = [ "black", From d4b1862a38060a3ce25deed108ec3e4fcf4b30e2 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sat, 26 Jul 2025 09:59:02 -0400 Subject: [PATCH 08/10] Remove OpenFisca shared-data configuration This legacy configuration from OpenFisca is not needed for PolicyEngine UK --- pyproject.toml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3cacdfc53..20ddcd036 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -50,11 +50,6 @@ include = [ [tool.hatch.build.targets.wheel] packages = ["policyengine_uk"] -[tool.hatch.build.targets.wheel.shared-data] -"CHANGELOG.md" = "share/openfisca/openfisca-country-template/CHANGELOG.md" -"LICENSE" = "share/openfisca/openfisca-country-template/LICENSE" -"README.md" = "share/openfisca/openfisca-country-template/README.md" - [project.optional-dependencies] dev = [ "black", From be562bf17efa062f6ed5c7196c5a95843b178c6f Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sat, 26 Jul 2025 10:00:14 -0400 Subject: [PATCH 09/10] update nikhil's email --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 20ddcd036..de78a0a37 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,7 +7,7 @@ authors = [ { name = "PolicyEngine", email = "nikhil@policyengine.org" } ] maintainers = [ - { name = "Nikhil Woodruff", email = "nikhil.woodruff@outlook.com" } + { name = "Nikhil Woodruff", email = "nikhil@policyengine.org" } ] license = { text = "AGPL-3.0" } keywords = ["benefit", "microsimulation", "social", "tax"] From 6a40f9045482671110ff7945f2c2e5fd913e3ed7 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Sat, 26 Jul 2025 10:01:01 -0400 Subject: [PATCH 10/10] Clean up pyproject.toml - Simplify license format - Remove empty scripts section - Add useful project URLs (Issues, Changelog) --- pyproject.toml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index de78a0a37..5fe570d9d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ authors = [ maintainers = [ { name = "Nikhil Woodruff", email = "nikhil@policyengine.org" } ] -license = { text = "AGPL-3.0" } +license = "AGPL-3.0" keywords = ["benefit", "microsimulation", "social", "tax"] classifiers = [ "Development Status :: 5 - Production/Stable", @@ -31,9 +31,8 @@ dependencies = [ [project.urls] Homepage = "https://github.com/PolicyEngine/policyengine-uk" Repository = "https://github.com/PolicyEngine/policyengine-uk" - -[project.scripts] -# Add console scripts here if needed +Issues = "https://github.com/PolicyEngine/policyengine-uk/issues" +Changelog = "https://github.com/PolicyEngine/policyengine-uk/blob/master/CHANGELOG.md" [build-system] requires = ["hatchling"]