Python 3.15 Released With Lazy Imports, UTF-8 by Default, and a Faster JIT
Python 3.15.0 was released on October 9, about a week later than planned after a third release candidate.
Lazy imports
PEP 810 adds an opt-in lazy keyword:
lazy import json
The name is bound immediately, but the module is only loaded the first time you use it. Command-line tools that import large libraries they rarely need can start noticeably faster. Existing code is unaffected unless it opts in.
UTF-8 by default
PEP 686 makes UTF-8 the default text encoding. Opening a file without an encoding= argument no longer depends on the system locale. On Linux, where UTF-8 locales are already the norm, little changes; the big difference is on Windows. Code that relied on a non-UTF-8 locale encoding should be tested.
Faster JIT
The experimental JIT is now delivering real gains: around 7-8% faster than the standard interpreter on x86-64 Linux (geometric mean) and 11-12% on AArch64 macOS against the tail-calling interpreter.
Other additions
- New built-in types:
frozendict, an immutable, hashable dictionary, andsentinel, a standard way to create unique marker values - A new
profilingpackage that includes Tachyon, a sampling profiler that attaches to running processes and can produce flame graphs - Frame pointers enabled by default, which helps native stack traces and tools like perf and eBPF
- Stable ABI support for free-threaded builds
- Better error messages and more colourised command-line output
Getting it
Distributions will not switch their system Python mid-release; Fedora and rolling distributions adopt it first. To try it now without touching the system interpreter, use a version manager such as uv or pyenv, or build it into /usr/local with make altinstall as our building from source guide describes.