Python
Python 3.15 vs 3.11: What Changed and Should You Upgrade?
See what changed from Python 3.11 through 3.15, which features arrived in each release, what may break, and how to plan an upgrade.
On this page
Python 3.15.0 was released on October 9, 2026. If you are still running Python 3.11, you are not one release behind: you are four releases behind, and Python 3.11 receives only security fixes until October 2027.
This guide answers one question:
What changed from Python 3.11 to Python 3.15, and what actually matters to developers?
Every feature below is labelled with the version where it actually landed. A lot of what people call “new in 3.15” arrived in 3.12, 3.13 or 3.14. If you upgrade directly from 3.11, you get all of it at once, including all of the breaking changes.
All code examples were run on the official CPython 3.15.0 build. Each one states the minimum version it needs.
This is the broader, release-by-release view of Python 3.11 through 3.15; the Python hub links to the full learning path.
Quick answer
- Is 3.15 a meaningful upgrade from 3.11? Yes. The language, typing, error messages, profiling tools and runtime have all improved substantially. Some of the most useful changes for application code are new in 3.15:
lazy import,frozendict,sentineland UTF-8 as the default encoding. - Who should upgrade now: teams that own their runtime (APIs, CLIs, containers, automation workers) and whose dependencies already publish 3.15 wheels.
- Who should wait: anyone on a managed platform (notebooks, Spark, serverless) that does not offer 3.15 yet, and anyone whose compiled dependencies are not ready.
- Main compatibility caveat: going from 3.11 to 3.15 crosses four sets of removals and behavior changes. The two most likely to surprise you are UTF-8 as the default text encoding (3.15) and modules removed in 3.12 and 3.13 (
distutils,imp,cgi,telnetlib,lib2to3and others). - Performance: there is no single official “3.15 is X% faster than 3.11” number, so this article does not invent one. The verified numbers are workload-specific and listed in the performance section.
Already on 3.14? Use the focused Python 3.15 vs 3.14 comparison. For JIT numbers and a repeatable measurement plan, see the Python 3.15 performance deep dive.
Python 3.11 to 3.15: version timeline
| Version | Released | Support status (Oct 2026) | Headline changes |
|---|---|---|---|
| 3.11 | Oct 2022 | Security fixes only, until Oct 2027 | Faster CPython (about 1.25× vs 3.10 on average), fine-grained traceback locations, ExceptionGroup and except*, asyncio.TaskGroup, tomllib, typing.Self |
| 3.12 | Oct 2023 | Security fixes only, until Oct 2028 | type statement and generic syntax def f[T](), more flexible f-strings, comprehension inlining, sys.monitoring, Linux perf support, itertools.batched; distutils removed |
| 3.13 | Oct 2024 | Security fixes only, until Oct 2029 | New interactive REPL, colored tracebacks, experimental free-threaded build, experimental JIT (build option), copy.replace(), warnings.deprecated; 19 legacy modules removed |
| 3.14 | Oct 2025 | Bug fixes, until Oct 2030 | Free-threaded build officially supported, deferred annotations, template strings (t"..."), except A, B: without parentheses, concurrent.interpreters, compression.zstd, JIT included in Windows/macOS binaries (off by default) |
| 3.15 | Oct 2026 | Bug fixes, until Oct 2031 | lazy import, frozendict, sentinel, UTF-8 default encoding, unpacking in comprehensions, profiling package with the Tachyon sampling profiler, frame pointers by default, abi3t stable ABI for free-threaded extensions, upgraded (still experimental) JIT |
Python 3.13 and later get two years of bug fixes followed by three years of security fixes, so 3.15 is supported until about October 2031.
Python 3.11 vs 3.15 at a glance
| Area | Python 3.11 | Python 3.15 (and when it changed) |
|---|---|---|
| Interpreter | Specializing adaptive interpreter (new in 3.11) | Same foundation plus comprehension inlining (3.12) and a tail-calling interpreter in the official Windows x64 binaries (3.15) |
| JIT | None | Experimental and off by default. Added as a build option in 3.13, shipped in Windows/macOS binaries in 3.14, significantly upgraded in 3.15 |
| Multicore threads | GIL always on | Optional free-threaded build: experimental in 3.13, officially supported in 3.14, stable ABI for extensions (abi3t) in 3.15 |
| Startup/imports | All imports are eager | Explicit lazy import (3.15) |
| Language | match, except* |
Flexible f-strings (3.12), t"..." templates (3.14), except A, B: (3.14), [*x for x in xs] (3.15) |
| Built-in types | dict, object() sentinels |
frozendict and sentinel built-ins (3.15) |
| Typing | Self, LiteralString, TypeVarTuple |
type aliases and [T] syntax (3.12), @override (3.12), TypeIs and ReadOnly (3.13), deferred annotations (3.14), closed TypedDict and TypeForm (3.15) |
| Default text encoding | Locale-dependent (often cp1252 on Windows) |
UTF-8 everywhere (3.15) |
| Profiling | cProfile, profile |
sys.monitoring and perf support (3.12), safe external debugger attach (3.14), profiling package and Tachyon (3.15), frame pointers by default (3.15) |
| Error messages | Fine-grained locations (new in 3.11) | More “Did you mean” hints (3.12–3.15), colored tracebacks (3.13), cross-language method hints like .push → .append (3.15) |
| Removals | Baseline | distutils, imp, asyncore (3.12); 19 “dead batteries” modules and lib2to3 (3.13); old ast node classes (3.14); sre_* modules and load_module() (3.15) |
The biggest Python 3.15 changes
These are new in 3.15. None of them existed in 3.14.
Explicit lazy imports (PEP 810)
What it is: a lazy soft keyword. A lazy import binds the name immediately but delays loading the module until the name is first used.
# Requires Python 3.15+
lazy import decimal
import sys
print("decimal loaded at startup?", "decimal" in sys.modules)
price = decimal.Decimal("19.99")
print("decimal loaded after use?", "decimal" in sys.modules)
print(price * 3)
decimal loaded at startup? False
decimal loaded after use? True
59.97
lazy from pathlib import Path works the same way.
Rules worth knowing:
lazyis only allowed at module level. Inside a function, a class body or atry/exceptblock, it is aSyntaxError.lazy from module import *andlazy from __future__ import ...are not allowed.- An import error moves from startup to first use. A missing module now fails where it is used, not where it is imported:
# Requires Python 3.15+
lazy import does_not_exist
print("startup ok") # this prints
does_not_exist.run() # ModuleNotFoundError raised here
- You can make every import lazy without editing code with
-X lazy_imports=allorPYTHON_LAZY_IMPORTS=all. The default isnormal, which only honors thelazykeyword. Treatallas an experiment: modules with import-time side effects (registering plugins, patching other modules) can change behavior.
Libraries that still support older Pythons cannot use the lazy keyword, because it is a syntax error on 3.14 and earlier. PEP 810 provides a compatible alternative: a module-level __lazy_modules__ list. Python 3.15 makes the listed imports lazy, and older versions simply ignore the variable.
# Runs on any Python 3; lazy only on 3.15+
__lazy_modules__ = ["decimal"]
import decimal
When it is useful: CLIs with many subcommands, applications with large dependency trees, short-lived jobs, serverless functions, and anything that imports heavy libraries on code paths most runs never take.
Does it matter to normal developers? Yes, if startup time matters to you. It is one of the most practical 3.15 features. Measure before and after with python -X importtime (available since 3.7).
frozendict: a built-in immutable mapping (PEP 814)
What it is: a new built-in type with the read-only part of the dict API. It is hashable when its keys and values are hashable. It is not a subclass of dict.
# Requires Python 3.15+
DEFAULTS = frozendict(env="dev", region="eu-west", retries=3)
prod = DEFAULTS | {"env": "prod"} # creates a new frozendict
print(prod)
print(DEFAULTS["env"])
try:
DEFAULTS["env"] = "prod"
except TypeError as exc:
print(exc)
# Hashable, so it can be a dict key or a cache key
row_counts = {frozendict(table="orders", day="2026-10-01"): 1_204}
print(row_counts[frozendict(day="2026-10-01", table="orders")])
print(isinstance(DEFAULTS, dict))
frozendict({'env': 'prod', 'region': 'eu-west', 'retries': 3})
dev
'frozendict' object does not support item assignment
1204
False
When it is useful: configuration defaults, metadata shared between threads, cache keys built from several fields, and return values that callers must not mutate. json, pickle, copy and pprint support it.
Watch out for: code that checks isinstance(x, dict). A frozendict fails that check. Check against collections.abc.Mapping if both types should be accepted.
Before 3.15, the usual workaround was types.MappingProxyType. That is a read-only view of a dict that can still change underneath, and it is not hashable.
sentinel: a built-in for “no value was passed” (PEP 661)
What it is: a built-in that creates unique marker objects with a readable repr, copy and pickle support, and support in type hints.
# Requires Python 3.15+
MISSING = sentinel("MISSING")
def get_setting(name: str, default: str | None | MISSING = MISSING) -> str | None:
settings = {"region": "eu-west", "proxy": None}
if name in settings:
return settings[name]
if default is MISSING:
raise KeyError(name)
return default
print(get_setting("proxy")) # None: the setting exists and is None
print(get_setting("timeout", default=None)) # None: the caller chose None
print(MISSING)
None
None
MISSING
When it is useful: any API where None is a legitimate value, such as settings, partial updates and optional parameters in libraries. It replaces the _MISSING = object() pattern, whose repr is an unhelpful <object object at 0x...>.
Does it matter to normal developers? It is a small improvement for application code, and more useful for library authors.
UTF-8 is the default encoding (PEP 686)
What it is: Python 3.15 runs in UTF-8 mode by default, whatever the operating system locale. open(), Path.read_text() and other text I/O without an explicit encoding= now use UTF-8.
This is probably the most important behavior change for anyone coming from 3.11, especially on Windows. On a Western-European Windows machine, Python 3.11 used cp1252 when you did not pass an encoding.
# Python 3.15
import sys, locale
print(sys.flags.utf8_mode) # 1
print(locale.getpreferredencoding(False)) # utf-8
What can break: scripts that read files written in a legacy code page without specifying an encoding. They now get a UnicodeDecodeError or garbled characters instead of the right text.
How to prepare while still on 3.11:
# Python 3.10+: warn wherever the encoding is not specified
python -X warn_default_encoding -m pytest
# Python 3.7+: run your tests the way 3.15 will behave
python -X utf8 -m pytest
You can opt out on 3.15 with PYTHONUTF8=0 or -X utf8=0. The better fix is to pass encoding= explicitly wherever you read or write text files.
Unpacking in comprehensions (PEP 798)
# Requires Python 3.15+
batches = [["a.csv", "b.csv"], ["c.csv"], []]
files = [*batch for batch in batches]
print(files) # ['a.csv', 'b.csv', 'c.csv']
partitions = [{"orders": 120}, {"customers": 40}, {"orders": 125}]
latest = {**p for p in partitions}
print(latest) # {'orders': 125, 'customers': 40}
This replaces [x for batch in batches for x in batch] and itertools.chain.from_iterable. It is pleasant to have, but not a reason to upgrade by itself.
The profiling package and the Tachyon sampling profiler (PEP 799)
What it is: a new profiling package. profiling.tracing is the deterministic profiler, the same one as cProfile, which remains available. profiling.sampling is Tachyon, a new statistical sampling profiler that can sample at very high rates and attach to an already running process.
# Python 3.15+
python -m profiling.sampling run etl.py # table of hottest functions
python -m profiling.sampling run --flamegraph -o flame.html etl.py # HTML flame graph
python -m profiling.sampling run -m mypackage.job # profile a module
python -m profiling.sampling attach 12345 # attach to a running PID
python -m profiling.sampling dump 12345 # one-off stack snapshot
It also supports --mode cpu|wall|gil|exception, --async-aware for asyncio tasks, and a --live terminal view.
Why it matters: a tracing profiler records every call and slows the program down, which can distort the result. A sampling profiler looks at the stack periodically, so it is better suited to long-running or production-like workloads. “Attach to a PID” is exactly what you need when a worker is stuck or slow and you cannot restart it with profiling enabled.
Deprecation: the pure-Python profile module is deprecated and scheduled for removal in 3.17. cProfile stays.
Frame pointers enabled by default (PEP 831)
CPython 3.15 is built with frame pointers on supported platforms. You will not notice this in your code. It matters to platform and performance engineers because system profilers (perf, eBPF-based tools, and continuous profilers) can reconstruct mixed Python/native call stacks more reliably.
Typing: closed TypedDict, TypeForm, disjoint_base
# Requires Python 3.15+ (the type checker enforces these rules, not the runtime)
from typing import TypedDict
class Row(TypedDict, closed=True): # no keys beyond these
id: int
name: str
class Metrics(TypedDict, extra_items=float): # extra keys allowed, values must be float
run_id: str
m: Metrics = {"run_id": "r1", "rows_per_sec": 1250.0}
Closed TypedDicts (PEP 728) are useful for typing JSON payloads and records where unexpected keys are a bug. TypeForm (PEP 747) lets you annotate functions that take a type as a value, such as validators and cast-like helpers. @typing.disjoint_base (PEP 800) is mainly for type checker and stub authors.
Your type checker needs to support these PEPs before they are useful. Check your mypy or pyright version.
Other 3.15 changes worth knowing
- Better error messages. These hints appear in tracebacks:
AttributeError: 'list' object has no attribute 'push'. Did you mean '.append'?
AttributeError: 'dict' object has no attribute 'put'. Use d[k] = v.
math.integer: a new module that groups integer-only functions (comb,factorial,gcd,isqrt,lcm,perm).- Package startup files (PEP 829): packages can declare startup entry points in
.startfiles.importlines in.pthfiles are now silently deprecated. This matters if you maintain tooling that relies on.pthtricks. bytearray.take_bytes()gets bytes out of abytearraywithout copying.- Free-threaded stable ABI (
abi3t, PEP 803): C extensions can now ship a single wheel for free-threaded builds instead of one per Python version. This is invisible to application developers, but it should help package support for free threading.
Practical code examples: features you get from 3.12–3.14 too
If you upgrade from 3.11, these earlier features are new to you as well. Each example states its minimum version. All of them run on 3.15.
# Requires Python 3.12+: generic syntax, type aliases, f-strings, batched
from itertools import batched
type Batch[T] = list[T]
def first[T](items: list[T]) -> T:
return items[0]
print(list(batched(range(7), 3))) # [(0, 1, 2), (3, 4, 5), (6,)]
tables = ["orders", "customers"]
print(f"tables: {", ".join(tables)}") # reusing the same quote is a SyntaxError on 3.11
# Requires Python 3.13+: copy.replace for immutable records
import copy
from dataclasses import dataclass
@dataclass(frozen=True)
class Job:
name: str
retries: int = 3
print(copy.replace(Job("load_orders"), retries=5))
# Job(name='load_orders', retries=5)
# Requires Python 3.14+: template strings and except without parentheses
from string.templatelib import Interpolation
table = "orders"
query = t"SELECT * FROM {table}"
values = [part.value for part in query if isinstance(part, Interpolation)]
print(type(query).__name__, values) # Template ['orders']
try:
int("x")
except ValueError, TypeError:
print("caught")
Template strings are useful because, unlike f-strings, they do not produce a string straight away. A library receives the literal parts and the interpolated values separately, so it can escape or parameterize the values safely. SQL and HTML are the obvious use cases.
What changed between 3.11 and 3.15 beyond syntax
Interpreter and runtime
- 3.12 inlined list, dict and set comprehensions, which the 3.12 release notes say makes them up to 2× faster.
- 3.13 shipped an experimental free-threaded build (a separate interpreter, typically named
python3.13t) and an experimental JIT that had to be enabled at build time. It also defined the semantics oflocals()(PEP 667), which can affect debuggers and code that modifieslocals(). - 3.14 made the free-threaded build officially supported (PEP 779), with a single-threaded slowdown of roughly 5–10% according to the release notes. Windows and macOS binaries started to include the JIT, disabled by default. 3.14 also added
concurrent.interpretersandInterpreterPoolExecutorfor running multiple isolated interpreters in one process (PEP 734). - 3.15 upgraded the JIT and made the official Windows x64 binaries use the tail-calling interpreter. On macOS, the official installer now installs free-threading support by default.
Typing
- 3.12:
type Alias = ...,def f[T](x: T) -> T,@override, andTypedDictfor**kwargs. - 3.13: type parameter defaults,
TypeIs,ReadOnly, and@warnings.deprecated. - 3.14: annotations are evaluated lazily (PEP 649/749), so forward references no longer need quotes. Code that reads
__annotations__directly should switch toannotationlib.get_annotations().from __future__ import annotationsis now deprecated, but it still works. - 3.15: closed
TypedDict,TypeForm,disjoint_base. The keyword formNamedTuple("P", x=int)is no longer supported.
Standard library
- 3.11:
tomllib,asyncio.TaskGroup,asyncio.timeout(). - 3.12:
itertools.batched,pathlib.Path.walk(). - 3.13:
copy.replace(). - 3.14:
compression.zstd(Zstandard in the standard library), asyncio introspection, and syntax highlighting in the REPL. - 3.15:
frozendict,sentinel,profiling,math.integer, and fasterbase64,base32,base85andcsv.Sniffer.
Startup and imports
Python 3.11 made startup about 10–15% faster by freezing core modules. Python 3.15 is the first version that lets you defer imports, with lazy import. Nothing between 3.12 and 3.14 offered that.
Debugging and observability
- 3.12:
sys.monitoring(PEP 669) for low-overhead profilers, debuggers and coverage tools, and Linuxperfintegration with-X perf. - 3.13: a new REPL with multiline editing and colored tracebacks by default.
- 3.14: a safe external debugger interface (PEP 768), so a debugger can attach to a running process.
- 3.15: Tachyon, frame pointers, and better error hints.
Packaging and workflow
- 3.12:
venvno longer installssetuptools, anddistutilsis gone. Oldsetup.py-based workflows that relied on either of them needpip install setuptoolsor a move topyproject.toml. - 3.14: on Linux and other Unix platforms except macOS,
multiprocessingandProcessPoolExecutornow start processes withforkserverinstead offork. Code that relied on children inheriting global state can fail withNameErroror pickling errors. - 3.15: official Windows downloads point to the Python install manager (
py install 3.15).
Performance: what is actually verified
It is important to separate language features from CPython implementation improvements. Lazy imports are a language feature: they work on any Python 3.15 implementation and you control them in code. The JIT, the tail-calling interpreter and frame pointers are CPython implementation details: their effect depends on the build, the platform and the workload.
These are the numbers published by the CPython project itself. This article adds no others.
| Change | Version | Published figure | Context |
|---|---|---|---|
| Faster CPython | 3.11 | 10–60% faster than 3.10; about 1.25× on average | pyperformance benchmark suite |
| Comprehension inlining | 3.12 | Comprehensions up to 2× faster | Comprehension-heavy microbenchmarks |
| Free-threaded build | 3.14 | 5–10% single-threaded slowdown | The price of removing the GIL; gains only come from parallel threads |
| JIT | 3.15 | 7–8% geometric mean on x86-64 Linux; 11–12% on AArch64 macOS | Individual benchmarks range from about 15% slower to over 100% faster |
| Tail-calling interpreter | 3.15 (Windows x64 binaries) | 15–20% vs the switch-case interpreter | pyperformance geometric mean on Windows x86-64 |
base64 |
3.15 | Encode 2× faster, decode 3× faster | Only if your workload encodes or decodes base64 |
| Base32 / Base85 / Ascii85 / Z85 | 3.15 | About two orders of magnitude faster | Rewritten in C |
csv.Sniffer.sniff() |
3.15 | Up to 1.6× faster | Delimiter detection only, not csv.reader |
What this means in practice:
- There is no official end-to-end “3.11 → 3.15” speedup figure. Your gain depends on your workload. For data work, much of the runtime is often spent in native libraries (NumPy, Arrow, database drivers), and interpreter improvements do not speed those up.
- The JIT is still experimental and off by default. In the official Windows and macOS binaries you enable it with
PYTHON_JIT=1. Benchmark your own workload with it on and off. Some benchmarks get slower. - Free threading is a different build, not a setting you turn on. It helps CPU-bound Python code that is split across threads, and only if all your C extensions support it. Single-threaded code runs a little slower.
- Measure startup and steady state separately. Lazy imports improve startup time. The JIT and interpreter work affect long-running loops.
# Startup: which imports cost the most?
python -X importtime -c "import mypackage.cli" 2> imports.log
# Steady state: compare the same workload across versions
python3.11 bench_transform.py
python3.15 bench_transform.py
PYTHON_JIT=1 python3.15 bench_transform.py
Breaking changes and removals (3.11 → 3.15)
Upgrading directly from 3.11 means taking every removal from 3.12 to 3.15 at once. These are the ones most likely to affect real projects.
Removed modules and APIs
| Removed in | What | Replacement |
|---|---|---|
| 3.12 | distutils |
setuptools, pyproject.toml-based builds |
| 3.12 | imp |
importlib |
| 3.12 | asynchat, asyncore |
asyncio |
| 3.13 | cgi, cgitb, crypt, telnetlib, pipes, nntplib, imghdr, sndhdr, uu, xdrlib, aifc, audioop, chunk, mailcap, msilib, nis, ossaudiodev, spwd, sunau (PEP 594) |
Third-party packages or email, subprocess, shlex equivalents |
| 3.13 | 2to3 and lib2to3 |
Modern parsers such as LibCST or Parso |
| 3.14 | ast.Num, ast.Str, ast.Bytes, ast.NameConstant, ast.Ellipsis |
ast.Constant |
| 3.14 | pkgutil.find_loader(), pkgutil.get_loader() |
importlib.util.find_spec() |
| 3.15 | sre_compile, sre_constants, sre_parse |
re |
| 3.15 | importlib Loader.load_module() |
exec_module() |
| 3.15 | http.server.CGIHTTPRequestHandler |
A real application server |
| 3.15 | PurePath.is_reserved(), platform.java_ver(), types.CodeType.co_lnotab |
See the 3.15 What’s New |
Behavior changes that can break code without an import error
- UTF-8 default encoding (3.15). See above. This is the most common one.
asyncio.get_event_loop()(3.14) raisesRuntimeErrorwhen there is no current event loop. Useasyncio.run()orasyncio.Runner.multiprocessingstart method (3.14) isforkserveron Linux. Passget_context("fork")explicitly if you really needfork.- Invalid escape sequences (3.12) such as
"\d"emit aSyntaxWarninginstead of aDeprecationWarning, so warnings now appear in code that was silent before. Use raw strings:r"\d". - Annotations (3.14) are evaluated lazily. Libraries that inspect
__annotations__at class-creation time can behave differently. sqlite3.connect()(3.15): every parameter exceptdatabaseis now keyword-only.sqlite3.connect("db", 5.0)raisesTypeError; writetimeout=5.0.argparse(3.15): withadd_argument("-f", "-foo"),destis now"foo"instead of"f".base64.urlsafe_b64decode()(3.15) no longer requires padding. Passpadded=Trueif your validation relied on the error.unittestassertWarns*()(3.15) no longer swallows unrelated warnings, so test runs may show warnings that were hidden before.datetime.strptime()(3.15) with%dbut no year now raisesValueError.- Typing (3.15):
NamedTuple("P", x=int)andTypedDict("TD")with no fields are no longer supported.
Deprecations to clean up now
profilemodule: removal in 3.17. Useprofiling.tracingorcProfile.- asyncio policy system (
set_event_loop_policy()and related APIs): removal in 3.16. Useasyncio.run(..., loop_factory=...)orasyncio.Runner. typing.ByteStringandcollections.abc.ByteString: removal in 3.17. Usecollections.abc.Buffer.importlines in.pthfiles: deprecated by PEP 829. They are ignored when a matching.startfile exists.
Compatibility checklist
Before upgrading:
- Dependencies: every pinned package has a release that supports 3.15. Check PyPI classifiers, changelogs and the files listed for each release, not just “it installs”.
- Compiled/native packages: wheels exist for
cp315on every OS and CPU you deploy to. Without them,pipfalls back to building from source, which fails or behaves differently in CI. - Tests: the full suite passes on 3.15 with warnings visible (
-W defaultor-X dev). - Encoding: the tests pass on 3.11 with
-X utf8, and-X warn_default_encodingreports no missingencoding=arguments. - Removed modules:
grepfordistutils,imp,cgi,telnetlib,pipes,lib2to3,ast.Num,sre_andpkgutil.find_loader. - CI images: your CI provider’s runner image or setup action offers 3.15.
- Docker base images: the exact 3.15 tag you plan to use exists for your distribution (slim, Alpine, distroless).
- Linters, formatters and type checkers: your Ruff, Black, mypy or pyright version can parse
lazy importand understands the new typing features. Tools that cannot parse the syntax will fail on any file that uses it. - pandas, PySpark and data libraries: each one officially supports 3.15 in the version you pin (see the next section).
- Cloud runtimes: your serverless or managed platform offers a 3.15 runtime. Do not assume it does.
- Observability agents: APM, tracing and profiling agents that hook into the interpreter support 3.15.
Python 3.15 for data engineers
The key distinction
A new CPython release does not mean your data platform runs it. Managed Spark runtimes, notebook services, Microsoft Fabric, Databricks, cloud functions and orchestration services each decide which Python version they offer, and they usually lag new CPython releases. Until your platform’s runtime documentation lists Python 3.15, none of the 3.15 features in this article are available to your notebooks or jobs there.
With PySpark there is an extra constraint: the driver and the workers must run the same Python minor version. You cannot run 3.15 on the driver while the cluster workers run an older version.
What helps where you do control the runtime
- ETL scripts and CLIs:
lazy importcan noticeably reduce startup time for tools that import pandas, PyArrow, cloud SDKs and database drivers on paths most runs never take. This matters for short, frequently scheduled jobs. - Orchestration: schedulers that repeatedly parse pipeline definition files pay the import cost each time. Lazy imports in those definition modules are a natural fit, once your orchestrator supports 3.15.
- File handling: UTF-8 by default removes a whole class of “works on Linux, breaks on Windows” CSV bugs with the standard
open()andcsvmodules. pandasread_csvalready defaulted to UTF-8, so its behavior does not change. Legacy files exported incp1252orlatin-1now need an explicitencoding=. - Configuration:
frozendictis a good fit for job configuration that is shared between threads or used as a cache key. - Diagnostics: Tachyon’s
attachmode lets you profile a slow, long-running Python worker without restarting it. Remember that for PySpark, most of the work runs in the JVM and the profiler only sees the Python side. - Free threading: it can make threads useful for CPU-bound pure-Python transforms, but only once your entire native stack (NumPy, pandas, PyArrow, drivers) supports the free-threaded build. Test it as a separate project, not as part of the upgrade.
pandas, notebooks and shared libraries
- Check the supported Python versions in the release notes of the exact pandas, NumPy and PyArrow versions you pin. Do not assume “latest pandas” supports a Python version released last week.
- Notebook kernels follow the environment they run in. A 3.15 kernel needs its own environment with 3.15-compatible packages.
- Shared internal libraries used by both managed notebooks and self-hosted jobs should keep supporting the oldest Python version among your platforms. Use
__lazy_modules__instead of thelazykeyword, and avoid 3.15-only built-ins in shared code until every platform has 3.15.
For hands-on data work, see reading CSV files with pandas, inspecting a DataFrame, filtering rows in pandas, and making Fabric notebooks faster.
Should you upgrade from Python 3.11 to 3.15?
| Upgrade now if… | Test first if… | Wait if… |
|---|---|---|
| You own the runtime (container, VM, CLI) | You use many compiled extensions or niche native packages | Your managed platform (Spark, notebooks, serverless) does not offer 3.15 |
| Your key dependencies already publish 3.15 wheels | You run on Windows and read or write files without encoding= |
A critical dependency has not announced 3.15 support |
| Startup time matters and lazy imports would help | You rely on multiprocessing with fork semantics on Linux |
Your linters, type checkers or APM agents cannot handle 3.15 yet |
| You are starting a new service | Your code or libraries read __annotations__ directly |
You are mid-release on a regulated or frozen system |
| You need a version supported until 2031 | You want to evaluate the JIT or free threading |
If you cannot go straight to 3.15, moving from 3.11 to 3.14 is a reasonable intermediate step. It brings most of the cumulative improvements, has broader ecosystem support today, and is supported until 2030.
Migration plan
- Create a 3.15 environment alongside the existing one:
py install 3.15on Windows, your distribution’s package or official installer elsewhere, thenpython3.15 -m venv .venv315. - Install dependencies from your lock file. Any package that tries to build from source tells you which wheels are missing.
- Run the full test suite with warnings visible:
python -X dev -m pytest. - Run linters and type checkers pinned to versions that support 3.15.
- Inspect warnings and deprecations. Fix everything scheduled for removal in 3.16 or 3.17 now, while it is still a warning.
- Benchmark critical workloads. Measure startup time and steady-state throughput separately, on 3.11 and 3.15, with and without
PYTHON_JIT=1if the JIT interests you. - Deploy gradually: CI matrix first, then staging, then a canary instance. Compare error rate, CPU, memory and latency before rolling out to all instances.
Final takeaway
Python 3.15 is not one dramatic change. It is the point where four years of CPython work become something you can actually use: a mature runtime, an optional free-threaded build, a JIT that is starting to pay off, much better profiling, and practical language additions such as lazy import, frozendict and sentinel.
For a team on 3.11, the decision is mostly about dependencies and platforms, not Python itself. If you own your runtime and your dependency stack supports 3.15, start testing now, beginning with the UTF-8 change. If a managed platform decides your Python version, plan the upgrade for when it offers 3.15, and keep shared code compatible with the older version until then.
Either way, 3.11 reaches end of life in October 2027. The upgrade is coming, and it is easier to do on your own schedule.
Official sources
- What’s New in Python 3.15: https://docs.python.org/3.15/whatsnew/3.15.html
- Python 3.15.0 release: https://www.python.org/downloads/release/python-3150/
- Python 3.15 release schedule (PEP 790): https://peps.python.org/pep-0790/
- Status of Python versions: https://devguide.python.org/versions/
- PEP 810 (explicit lazy imports): https://peps.python.org/pep-0810/
- PEP 814 (frozendict): https://peps.python.org/pep-0814/
- PEP 661 (sentinel values): https://peps.python.org/pep-0661/
- PEP 686 (UTF-8 mode by default): https://peps.python.org/pep-0686/
- PEP 799 (profiling package): https://peps.python.org/pep-0799/
- What’s New in Python 3.14: https://docs.python.org/3.14/whatsnew/3.14.html
- What’s New in Python 3.13: https://docs.python.org/3.13/whatsnew/3.13.html
- What’s New in Python 3.12: https://docs.python.org/3.12/whatsnew/3.12.html
- What’s New in Python 3.11: https://docs.python.org/3.11/whatsnew/3.11.html
Was this helpful?
What could be better?
Thanks — that helps me improve Javi Builds.
Continue learning
- Cheat sheetSort, Rank and Deduplicate DataSort, rank, and deduplicate pandas data safely by defining deterministic order, business keys, tie behavior, and the exact row that should survive.Open cheat sheet
- ArticlePython 3.15 Performance: What Actually Got Faster?See what actually got faster in Python 3.15, including JIT improvements, startup behavior, standard-library optimizations, profiling, and how to benchmark your own code.Read article
What should I build next?
I'm building Javi Builds around practical problems data engineers actually face. Tell me what you'd like to see next.
Stay in the loop
Get the Javi Builds updates you actually care about.
Check your inbox
I sent you a confirmation link. Your subscription will be active after you confirm it.