Skip to content

Commit 7bdde45

Browse files
authored
Merge pull request #1266 from PolicyEngine/python-3.13-support
Add Python 3.13 support
2 parents 24dc366 + 6a40f90 commit 7bdde45

8 files changed

Lines changed: 41 additions & 38 deletions

File tree

.github/workflows/code_changes.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ jobs:
2727
id-token: "write"
2828
steps:
2929
- name: Checkout repo
30-
uses: actions/checkout@v2
30+
uses: actions/checkout@v4
3131
- name: Install uv
3232
uses: astral-sh/setup-uv@v5
3333

3434
- name: Set up Python
35-
uses: actions/setup-python@v2
35+
uses: actions/setup-python@v5
3636
with:
37-
python-version: '3.12'
37+
python-version: '3.13'
3838
- uses: "google-github-actions/auth@v2"
3939
with:
4040
workload_identity_provider: "projects/322898545428/locations/global/workloadIdentityPools/policyengine-research-id-pool/providers/prod-github-provider"
@@ -51,7 +51,7 @@ jobs:
5151
env:
5252
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}
5353
- name: Upload coverage to Codecov
54-
uses: codecov/codecov-action@v3
54+
uses: codecov/codecov-action@v4
5555
with:
5656
file: ./coverage.xml
5757
fail_ci_if_error: false

.github/workflows/docs_changes.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ jobs:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout repo
18-
uses: actions/checkout@v2
18+
uses: actions/checkout@v4
1919
- name: Install uv
2020
uses: astral-sh/setup-uv@v5
2121

2222
- name: Set up Python
23-
uses: actions/setup-python@v2
23+
uses: actions/setup-python@v5
2424
with:
25-
python-version: '3.12'
25+
python-version: '3.13'
2626

2727
- name: Install package
2828
run: uv pip install -e .[dev] --system

.github/workflows/pr_code_changes.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ jobs:
2727
id-token: "write"
2828
steps:
2929
- name: Checkout repo
30-
uses: actions/checkout@v2
30+
uses: actions/checkout@v4
3131
- name: Install uv
3232
uses: astral-sh/setup-uv@v5
3333

3434
- name: Set up Python
35-
uses: actions/setup-python@v2
35+
uses: actions/setup-python@v5
3636
with:
37-
python-version: '3.11'
37+
python-version: '3.13'
3838
- uses: "google-github-actions/auth@v2"
3939
with:
4040
workload_identity_provider: "projects/322898545428/locations/global/workloadIdentityPools/policyengine-research-id-pool/providers/prod-github-provider"
@@ -51,7 +51,7 @@ jobs:
5151
env:
5252
HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }}
5353
- name: Upload coverage to Codecov
54-
uses: codecov/codecov-action@v3
54+
uses: codecov/codecov-action@v4
5555
with:
5656
file: ./coverage.xml
5757
fail_ci_if_error: false

.github/workflows/pr_docs_changes.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ jobs:
1616
name: Test documentation builds
1717
steps:
1818
- name: Checkout repo
19-
uses: actions/checkout@v2
19+
uses: actions/checkout@v4
2020
- name: Install uv
2121
uses: astral-sh/setup-uv@v5
2222

2323
- name: Set up Python
24-
uses: actions/setup-python@v2
24+
uses: actions/setup-python@v5
2525
with:
26-
python-version: '3.12'
26+
python-version: '3.13'
2727

2828
- name: Install package
2929
run: uv pip install -e .[dev] --system

.github/workflows/versioning.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ jobs:
4141
GH_TOKEN: ${{ secrets.POLICYENGINE_GITHUB }}
4242
steps:
4343
- name: Checkout repo
44-
uses: actions/checkout@v2
44+
uses: actions/checkout@v4
4545
- name: Install uv
4646
uses: astral-sh/setup-uv@v5
4747

4848
- name: Set up Python
49-
uses: actions/setup-python@v2
49+
uses: actions/setup-python@v5
5050
with:
51-
python-version: '3.12'
51+
python-version: '3.13'
5252
- name: Install package
5353
run: uv pip install -e .[dev] --system
5454
- name: Install policyengine

changelog_entry.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
- bump: patch
2+
changes:
3+
changed:
4+
- Add Python 3.13 support and update CI workflows
5+
- Updated policyengine-core dependency to >=3.19.0 for Python 3.13 support
6+
- Updated GitHub Actions to latest versions (checkout@v4, setup-python@v5) for Python 3.13 compatibility
7+
- Set all workflows to use Python 3.13
8+
removed:
9+
- Removed unused tables dependency that was blocking Python 3.13 compatibility

policyengine_uk/variables/gov/dwp/winter_fuel_allowance.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,12 @@ def formula(household, period, parameters):
4545
)
4646

4747
meets_mtb_requirement = (
48-
on_mtb | ~wfp.eligibility.require_benefits | meets_income_passport
48+
on_mtb
49+
| (not wfp.eligibility.require_benefits)
50+
| meets_income_passport
4951
)
50-
meets_spa_requirement = (
51-
household.any(is_SP_age)
52-
| ~wfp.eligibility.state_pension_age_requirement
52+
meets_spa_requirement = household.any(is_SP_age) | (
53+
not wfp.eligibility.state_pension_age_requirement
5354
)
5455
meets_higher_age_requirement = household.any(
5556
age >= wfp.eligibility.higher_age_requirement

pyproject.toml

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,32 @@ authors = [
77
{ name = "PolicyEngine", email = "nikhil@policyengine.org" }
88
]
99
maintainers = [
10-
{ name = "Nikhil Woodruff", email = "nikhil.woodruff@outlook.com" }
10+
{ name = "Nikhil Woodruff", email = "nikhil@policyengine.org" }
1111
]
12-
license = { text = "AGPL-3.0" }
12+
license = "AGPL-3.0"
1313
keywords = ["benefit", "microsimulation", "social", "tax"]
1414
classifiers = [
1515
"Development Status :: 5 - Production/Stable",
1616
"License :: OSI Approved :: GNU Affero General Public License v3",
1717
"Operating System :: POSIX",
1818
"Programming Language :: Python",
19+
"Programming Language :: Python :: 3.10",
20+
"Programming Language :: Python :: 3.11",
21+
"Programming Language :: Python :: 3.12",
22+
"Programming Language :: Python :: 3.13",
1923
"Topic :: Scientific/Engineering :: Information Analysis",
2024
]
2125
requires-python = ">=3.10"
2226
dependencies = [
23-
"policyengine-core>=3.6.4",
24-
"microdf-python>=1.0.0",
27+
"policyengine-core>=3.19.3",
28+
"microdf-python>=1.0.2",
2529
]
2630

2731
[project.urls]
2832
Homepage = "https://github.com/PolicyEngine/policyengine-uk"
2933
Repository = "https://github.com/PolicyEngine/policyengine-uk"
30-
31-
[project.scripts]
32-
# Add console scripts here if needed
34+
Issues = "https://github.com/PolicyEngine/policyengine-uk/issues"
35+
Changelog = "https://github.com/PolicyEngine/policyengine-uk/blob/master/CHANGELOG.md"
3336

3437
[build-system]
3538
requires = ["hatchling"]
@@ -46,16 +49,6 @@ include = [
4649
[tool.hatch.build.targets.wheel]
4750
packages = ["policyengine_uk"]
4851

49-
[tool.hatch.build.targets.wheel.shared-data]
50-
"CHANGELOG.md" = "share/openfisca/openfisca-country-template/CHANGELOG.md"
51-
"LICENSE" = "share/openfisca/openfisca-country-template/LICENSE"
52-
"README.md" = "share/openfisca/openfisca-country-template/README.md"
53-
54-
[dependency-groups]
55-
dev = [
56-
"tables>=3.10.1",
57-
]
58-
5952
[project.optional-dependencies]
6053
dev = [
6154
"black",

0 commit comments

Comments
 (0)