Summary
Python 3.14 is scheduled for release on October 7, 2025. We should upgrade policyengine-core to support Python 3.14 and take advantage of its performance improvements and new features.
Key Benefits for PolicyEngine
Performance Improvements
- 3-5% geometric mean performance improvement across the board
- Up to 30% faster for certain workloads with newer compilers (Clang 19+ on x86-64/AArch64)
- Incremental garbage collection with reduced pause times
- New interpreter architecture with better optimization
Free-Threaded Python (No GIL)
- Free-threaded mode is now officially supported (no longer experimental)
- Performance penalty reduced to just 5-10% in single-threaded mode
- Opens the door for true parallel computation in microsimulations
- Could enable concurrent policy calculations without multiprocessing overhead
Type System & Numerical Improvements
- Deferred evaluation of type annotations (PEP 649/749) reduces import overhead
- New
float.from_number() and complex.from_number() methods
- Enhanced mixed-mode arithmetic rules
- Better type hint performance and flexibility
- New
annotationlib module for annotation introspection
Concurrency Features
InterpreterPoolExecutor for parallel processing
- Multiple interpreters in standard library
- Improved context variable and threading support
Other Improvements
- Native Zstandard compression support
- Improved error messages and debugging
- Experimental JIT compiler in binary releases
- Simpler exception handling syntax (PEP 758)
Implementation Plan
- Update
pyproject.toml to include Python 3.14 in supported versions
- Add Python 3.14 to CI/CD test matrix
- Test compatibility with all dependencies
- Update documentation to reflect Python 3.14 support
- Consider testing free-threaded mode for future parallel computation features
Priority
Medium-High - While Python 3.14 offers significant performance improvements, we should wait for initial release stability and ensure downstream dependencies (country models, API) are ready to upgrade in coordination.
References
Blocker
Blocked on tables (PyTables) shipping Python 3.14 wheels: PyTables/PyTables#1261
Summary
Python 3.14 is scheduled for release on October 7, 2025. We should upgrade policyengine-core to support Python 3.14 and take advantage of its performance improvements and new features.
Key Benefits for PolicyEngine
Performance Improvements
Free-Threaded Python (No GIL)
Type System & Numerical Improvements
float.from_number()andcomplex.from_number()methodsannotationlibmodule for annotation introspectionConcurrency Features
InterpreterPoolExecutorfor parallel processingOther Improvements
Implementation Plan
pyproject.tomlto include Python 3.14 in supported versionsPriority
Medium-High - While Python 3.14 offers significant performance improvements, we should wait for initial release stability and ensure downstream dependencies (country models, API) are ready to upgrade in coordination.
References
Blocker
Blocked on
tables(PyTables) shipping Python 3.14 wheels: PyTables/PyTables#1261