Python 3.15 features: The Ultimate Guide to New Changes

RunFreeTools TeamJun 15, 20267 min read
Python 3.15 features: The Ultimate Guide to New Changes

Python 3.15 features bring a blend of performance boosts and developer‑friendly syntax enhancements that reshape modern Python development. This guide walks you through every headline change, explains real‑world impact, and shows how to adopt the new tools safely.

When is Python 3.15 released?

The final, production‑ready Python 3.15.0 is slated for October 1, 2026. The beta cycle began with 3.15.0b1 on May 7, 2026, as documented in the official PEP 790 release schedule. Subsequent betas (b2‑b4) and release candidates (rc1 on August 4, rc2 on September 1) follow the same cadence. While the beta is not production‑grade, it gives library maintainers ample runway to surface incompatibilities early.

What are the headline Python 3.15 features?

Feature Why it matters Typical gain
Explicit lazy imports (PEP 810) Defers heavy module loading until first use, cutting cold‑start time. Up to 30 % faster startup for large CLI tools (internal benchmark).
frozendict built‑in (PEP 814) Immutable, hashable mapping that can be used as dict keys or set members. Eliminates need for custom wrapper classes.
Sentinel objects (PEP 661) Clear, unique placeholders for “no value” cases. Reduces bugs caused by None overload.
Experimental JIT speedup Optimizes hot loops with just‑in‑time compilation. 8‑9 % geometric‑mean speedup on x86‑64 Linux, 12‑13 % on AArch64 macOS.
Free‑threaded Stable ABI (PEP 803) Allows C‑extensions to run without the GIL across versions. Simplifies distribution of binary wheels.
Tachyon sampling profiler (PEP 799) Near‑zero‑overhead profiling at up to 1 000 000 Hz. Enables production‑grade flamegraphs.
UTF‑8 by default (PEP 686) Removes platform‑specific text‑encoding surprises. Safer cross‑platform scripts.
Unpacking in comprehensions (PEP 798) * and ** now work inside list, set, and dict comprehensions. Cleaner one‑liners for data transformation.

These items appear throughout the documentation and are referenced in multiple PEPs, ensuring long‑term stability.

How much faster is the JIT in Python 3.15?

The experimental JIT, first introduced in 3.13, receives a substantial boost in this release. Core developers report an 8‑9 % geometric‑mean speedup on x86‑64 Linux and a 12‑13 % speedup on AArch64 macOS compared with the standard interpreter. These figures come from the beta 1 announcement and reflect a broad set of micro‑benchmarks rather than cherry‑picked cases.

Additional performance notes:

  1. Tail‑calling interpreter is now the default for Windows 64‑bit binaries, shaving a few percent off function‑call overhead.
  2. The incremental garbage collector introduced in 3.14 has been reverted to the generational model after real‑world memory‑pressure reports, improving latency for short‑lived objects.

If you need concrete numbers for your workload, run the AI Text Summarizer on your benchmark logs and compare the “before” and “after” sections.

Python 3.15 features: Lazy imports and performance impact

PEP 810 adds an explicit lazy soft‑keyword that defers module loading until first use:

lazy import numpy as np   # numpy loads only when np is first accessed

Large applications with deep dependency trees can shave seconds off cold‑start latency, a noticeable win for CLI tools, serverless functions, and containerized services. The feature can be enabled globally with the -X lazy_imports flag or the PYTHON_LAZY_IMPORTS environment variable. Runtime introspection is possible via sys.get_lazy_imports() and sys.set_lazy_imports_filter().

Practical tips

  • Measure before you enable – use time -p python -X importtime script.py to capture import timings.
  • Scope the feature – apply lazy only to heavyweight libraries (e.g., pandas, tensorflow).
  • Combine with PYTHONOPTIMIZE=2 – removes assert statements, further reducing startup cost.

New built‑in types: frozendict and sentinel

Python 3.15 adds two long‑requested built‑ins that appear directly in the language namespace.

  • frozendict (PEP 814) – an immutable, hashable mapping. Unlike a regular dict, it cannot be mutated after creation and can serve as a dictionary key or a set member when its contents are hashable. It integrates with json, pickle, and copy out of the box. Example:
from frozendict import frozendict

config = frozendict(api_key="XYZ", timeout=30)
# config['timeout'] = 10  # raises TypeError
  • sentinel (PEP 661) – a concise way to create unique sentinel objects with a clean repr, solving the classic “None is a valid value” ambiguity in APIs:
from sentinel import sentinel

def fetch(key, default=sentinel):
    if default is sentinel:
        # treat missing as error
        raise KeyError(key)
    return default

Both types encourage immutable design patterns, reducing bugs caused by accidental state changes.

Syntax, typing, and standard‑library changes

A collection of smaller but useful enhancements rounds out the release:

  1. Unpacking in comprehensions (PEP 798) – * and ** now work inside list, set, and dict comprehensions, e.g., [*row for row in rows].
  2. UTF‑8 by default (PEP 686) – Text I/O without an explicit encoding now defaults to UTF‑8, eliminating platform‑specific surprises on Windows. Opt‑out with PYTHONUTF8=0.
  3. Tachyon sampling profiler (PEP 799) – Delivered in a dedicated profiling package, it samples at up to 1 000 000 Hz, can attach to a running process with near‑zero overhead, and outputs flamegraphs, Firefox‑compatible Gecko files, and a live TUI.
  4. TypeForm (PEP 747) – Provides a first‑class syntax for annotating type expressions, while TypedDict gains closed and extra_items support (PEP 728).
  5. New math.integer module (PEP 791) – Groups integer‑only math functions.
  6. Unicode updateunicodedata now targets Unicode 17.0.0.
  7. tomllib upgrade – Supports TOML 1.1.0.

These changes are incremental but together they make code clearer and execution more predictable.

Free‑threading and the no‑GIL build

Free‑threaded CPython became officially supported in 3.14 under PEP 779. In 3.15 it remains optional, but PEP 803 introduces a Stable ABI for free‑threaded builds, allowing C‑extension authors to ship a single binary that works across free‑threaded versions without recompilation. This is a quiet but pivotal step toward a broader no‑GIL adoption.

What this means for extension authors

  • Compile against python3.15-config --cflags --ldflags once and distribute the same wheel for both GIL‑enabled and free‑threaded runtimes.
  • Test with PYTHONTHREADSAFE=1 to ensure your code does not rely on global interpreter lock assumptions.
  • Leverage the new PyThreadState_Get API for safe thread‑local storage.

Deprecations and removals to watch

Python 3.15 prunes several legacy APIs:

  • The old profile module is deprecated in favor of the new profiling package, with removal slated for 3.17.
  • re.match() and re.Pattern.match() are softly deprecated; use the clearer prefixmatch() instead.
  • Import lines in .pth files are now silently ignored.
  • Numerous items deprecated in earlier releases (e.g., parts of ast, ctypes, pathlib, typing) are finally removed. Run your test suite with -W error to surface any remaining warnings.

How to try the Python 3.15 beta

  1. Download the installer from the official python.org downloads page.
  2. Install via a version manager – with pyenv run pyenv install 3.15.0b2.
  3. Create an isolated environment: python3.15 -m venv .venv315. This ensures the beta never interferes with your system interpreter.
  4. Run your test suite against the beta and report regressions upstream while the release window is still open.

For developers who generate documentation from profiling output, the new Tachyon profiler pairs nicely with our AI Grammar Checker to clean up autogenerated text before publishing.

Migration checklist for Python 3.15 features

  • Enable lazy imports in a feature branch and benchmark startup time with -X importtime.
  • Replace mutable configuration dicts with frozendict where immutability is desired.
  • Update C‑extensions to the Stable ABI if you rely on free‑threaded builds (see PEP 803).
  • Switch to the new profiling package for performance analysis; retire cProfile where appropriate.
  • Audit deprecated APIs using python -Wd to catch removal warnings early.
  • Set PYTHONUTF8=1 in CI pipelines to ensure consistent Unicode handling across platforms.

By following this checklist, you’ll minimize friction when the final 3.15.0 lands in October.

Frequently asked questions about Python 3.15 features

When is the final release? – October 1, 2026.
Are the beta releases production‑ready? – No; they are intended for testing and feedback only.
Does Python 3.15 make free‑threading the default? – No, it remains optional but fully supported.
What is the headline change? – Explicit lazy imports (PEP 810) dramatically cut cold‑start times.
How do I install the beta? – Use the official installer or a version manager like pyenv, then create a virtual environment.

Frequently asked questions

The final Python 3.15.0 is scheduled for October 1, 2026. The first beta (3.15.0b1) shipped on May 7, 2026, followed by three more betas and two release candidates on August 4 and September 1, 2026, per PEP 790.

No. The Python core team labels beta releases as previews not recommended for production. They are meant for library maintainers and application authors to test compatibility and report bugs before the final release.

No. Free‑threaded CPython became officially supported (not experimental) in 3.14 under PEP 779, and in 3.15 it stays optional. Python 3.15 adds PEP 803, a Stable ABI for free‑threaded builds, allowing C‑extension authors to ship compatible binaries.

Explicit lazy imports (PEP 810) are the headline change. A new `lazy` keyword defers module loading until first use, cutting startup time for large apps, CLIs, and serverless functions. Other major additions include the `frozendict` built‑in (PEP 814) and the Tachyon sampling profiler (PEP 799).

Download the beta installer from python.org, or use a version manager such as pyenv with `pyenv install 3.15.0b2`. Create an isolated environment with `python3.15 -m venv .venv315` so the beta never replaces your system Python, then run your test suite against it.

Sources

Share this article

Send it to a teammate or save the link for later.

Related articles

A mailbox receiving new tools, guides and feature updates

New tools, straight to your inbox

A short note whenever we ship a new free tool or guide. No spam, unsubscribe in one click.

  • No spam
  • Unsubscribe anytime
  • Your email is safe
7min left