Drop Python 3.9 support (cleanup checklist)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- python
- Lĩnh vực
- build-system, ci-cd, tooling
Hướng nghiên cứu
Bắt đầu với các tệp pyproject.toml của bốn repository và các ma trận CI, sau đó kiểm tra các tệp Python được liệt kê cùng cấu hình Ruff và mypy của policyengine.py. Kiểm tra các phiên bản dependency và phần công việc tương thích với 3.9 hiện có trước khi thay đổi các mục có điều kiện. Hoàn thành có nghĩa là cả bốn repository đều hỗ trợ Python 3.10+, CI của chúng đều xanh và các môi trường 3.10 mới có thể cài đặt các extra us và uk.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Trigger
File when all confirmed 3.9 users (currently: Census) have migrated to 3.10+.
Background
Supporting 3.9 across the stack required working around non-trivial syntax and dependency cruft in four repos. ~95% of the cruft is 3.9-specific — dropping 3.9 alone recovers most of it, even if 3.10 support remains (3.10 hits EOL Oct 2026, ~6 months out, so keeping it through natural life is cheap).
Landed as: PolicyEngine/policyengine-core#454, PolicyEngine/policyengine-us#8035, PolicyEngine/policyengine-uk#1625, PolicyEngine/policyengine.py#278.
Checklist
All 4 repos
-
pyproject.toml: raiserequires-pythonfrom>=3.9to>=3.10 - Remove
Programming Language :: Python :: 3.9classifier - Remove
"3.9"from all CI Python matrices
policyengine-core (PolicyEngine/policyengine-core)
- Remove numpy env marker; go back to single
numpy>=2.1.0,<3(2.1+ supports 3.10+) - Hand-revert
Optional[X]/Tuple[X]→X | None/tuple[X]inpolicyengine_core/tools/hugging_face.pyandpolicyengine_core/tools/google_cloud.py(~5 sites; this repo's ruff config doesn't have UP rules enabled)
policyengine-us (PolicyEngine/policyengine-us)
- Remove
[tool.uv] environmentsblock inpyproject.tomlif it still exists (likely already gone once downstream core picks up 3.9-compat release) - Hand-revert
Optional[X]→X | Nonein:policyengine_us/system.py,data/economic_assumptions.py,data/dataset_schema.py,tests/core/test_payroll_contributions.py,tests/microsimulation/data/fixtures/test_extend_single_year_dataset.py(5 sites) - Regenerate
uv.lock
policyengine-uk (PolicyEngine/policyengine-uk)
- Remove
[tool.uv] environmentsblock (if still present) - Hand-revert 3 sites in
policyengine_uk/data/dataset_schema.pyandpolicyengine_uk/simulation.py -
policyengine_uk/tests/test_build_metadata.py: revertExitStackback to parenthesizedwith (a, b, c): -
[tool.ruff] target-version = "py39"→"py310" - Regenerate
uv.lock
policyengine.py (this repo)
-
pyproject.toml:[tool.ruff] target-version = "py39"→"py310"[tool.mypy] python_version = "3.9"→"3.10"- Remove
UP006,UP007,UP035,UP045from[tool.ruff.lint] ignore
- Auto-revert ~210 annotation sites:
ruff check --fix --unsafe-fixes .— this re-applies UP045 (Optional[X]→X | None), UP007 (Union[X, Y]→X | Y), UP006/UP035 (List→list). - Hand-revert the two discriminated-union sites ruff's UP rules don't cover:
src/policyengine/core/scoping_strategy.py:222(insideAnnotated[]) andsrc/policyengine/core/region.py:18(module-level type alias). - Simplify
Python-CompatCI job in.github/workflows/pr_code_changes.yaml— drop the explicith5pyinstall (needed becausescoping_strategy.pyimports it but extras weren't available; once[us]/[uk]extras are bumped to versions that pull h5py via core, it's redundant). - Bump
[us]/[uk]/[dev]extras offpolicyengine-us==1.602.0/policyengine-uk==2.74.0to versions that don't pin 3.11+ themselves (separate follow-up from this cleanup — may already be bumped by the time this issue is actioned).
Not in scope
Keep until 3.10 EOL (October 2026):
class Foo(str, Enum)pattern (4 files:outputs/{aggregate,change_aggregate,inequality,poverty}.py) — StrEnum is 3.11+timezone.utcincore/tax_benefit_model_version.py—datetime.UTCis 3.11+- Gotcha when
StrEnumreturns:str(Foo.X)differs —StrEnumreturns"x",(str, Enum)returns"Foo.X". Audit any code relying onstr()of enum members before reverting.
Keep until 3.12 EOL (October 2028):
TypeVar+Generic[T]pattern incore/cache.pyandcore/output.py— PEP 695class Foo[T]is 3.12+.
Verification
After cleanup, each repo's CI should be green with reduced matrix (3.10+). Cross-repo smoke: pip install policyengine[us] and pip install policyengine[uk] succeed on 3.10 in a fresh venv.
- Ngôn ngữ chính
- Python
- Star
- 8
- Fork
- 10
- Merge trung bình
- 21 giờ 4 phút
- Pull request đã merge (30 ngày)
- 43
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của PolicyEngine/policyengine.py
-
The Budget reform contract's household route errors in the qualification gate: policyengine.uk is NoneCó thể đã có người làm @MaxGhenis đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
PolicyEngine/policyengine.py#650 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Raise the simulation cache memory warning to 16 GiBCó thể đã có người làm @anth-volk đã nhận 17 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
PolicyEngine/policyengine.py#549 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
PolicyEngine/policyengine.py#473 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
PolicyEngine/policyengine.py#436 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Certify populace-uk as the UK certified defaultCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
PolicyEngine/policyengine.py#408 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của PolicyEngine/policyengine.py
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
sierra-research/tau2-bench#635 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
The add-ssm-model skill requires a Cython simulator; the contributing guide allows Python onesCó thể đã có người làm @fmuia đã nhận hôm nay. Đang mởdocumentation skill
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
lnccbrown/ssm-simulators#406 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
btclib-org/btclib-ecc#309 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
jbacalso24/mimry#459 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] POST /revoke with a FastMCP access token is a silent no-op (ownership gate never matches)Đang mởauth bug high-priority
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày