Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Drop Python 3.9 support (cleanup checklist)

Abierto
#279 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Tranquilo
Stack tecnológico
python

Línea de trabajo

Empieza por los cuatro archivos pyproject.toml de los repositorios y las matrices de CI; después inspecciona los archivos Python indicados y la configuración de Ruff y mypy de policyengine.py. Comprueba las versiones de las dependencias y el trabajo existente de compatibilidad con 3.9 antes de cambiar los elementos condicionales. Se considera terminado cuando los cuatro repositorios admitan Python 3.10+, su CI esté en verde y los entornos 3.10 nuevos puedan instalar los extras us y uk.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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: raise requires-python from >=3.9 to >=3.10
  • Remove Programming Language :: Python :: 3.9 classifier
  • 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] in policyengine_core/tools/hugging_face.py and policyengine_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] environments block in pyproject.toml if it still exists (likely already gone once downstream core picks up 3.9-compat release)
  • Hand-revert Optional[X] → X | None in: 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] environments block (if still present)
  • Hand-revert 3 sites in policyengine_uk/data/dataset_schema.py and policyengine_uk/simulation.py
  • policyengine_uk/tests/test_build_metadata.py: revert ExitStack back to parenthesized with (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, UP045 from [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 (inside Annotated[]) and src/policyengine/core/region.py:18 (module-level type alias).
  • Simplify Python-Compat CI job in .github/workflows/pr_code_changes.yaml — drop the explicit h5py install (needed because scoping_strategy.py imports 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 off policyengine-us==1.602.0 / policyengine-uk==2.74.0 to 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.utc in core/tax_benefit_model_version.py — datetime.UTC is 3.11+
  • Gotcha when StrEnum returns: str(Foo.X) differs — StrEnum returns "x", (str, Enum) returns "Foo.X". Audit any code relying on str() of enum members before reverting.

Keep until 3.12 EOL (October 2028):

  • TypeVar + Generic[T] pattern in core/cache.py and core/output.py — PEP 695 class 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.

Lenguaje dominante
Python
Estrellas
8
Forks
10
Merge medio
18 h 24 min
PR fusionados (30 d)
18

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de PolicyEngine/policyengine.py

Todos los issues de PolicyEngine/policyengine.py

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.