Python 3.14.0
python.orgNew features
* PEP 779: Free-threaded Python is officially supported
* PEP 649: The evaluation of annotations is now deferred, improving the semantics of using annotations.
* PEP 750: Template string literals (t-strings) for custom string processing, using the familiar syntax of f-strings.
* PEP 734: Multiple interpreters in the stdlib.
* PEP 784: A new module compression.zstd providing support for the Zstandard compression algorithm.
* PEP 758: except and except* expressions may now omit the brackets.
Syntax highlighting in PyREPL, and support for color in unittest, argparse, json and calendar CLIs.
* PEP 768: A zero-overhead external debugger interface for CPython.
UUID versions 6-8 are now supported by the uuid module, and generation of versions 3-5 are up to 40% faster.
* PEP 765: Disallow return/break/continue that exit a finally block.
* PEP 741: An improved C API for configuring Python.
A new type of interpreter. For certain newer compilers, this interpreter provides significantly better performance. Opt-in for now, requires building from source.
Improved error messages.
Builtin implementation of HMAC with formally verified code from the HACL* project.
A new command-line interface to inspect running Python processes using asynchronous tasks.
The pdb module now supports remote attaching to a running Python process.
More details: https://docs.python.org/3.14/whatsnew/3.14.html
I've created a library that use t-strings to prevent shell injection that even works on Windows. It's written in Rust. https://github.com/aspizu/tshu
$ uv run --with tshu python -m asyncio
>>> from tshu import sh
>>> username = "aspizu; rm -rf /"
>>> await sh(t"echo {username}")
aspizu; rm -rf /Does the library handle arguments that begin with a dash?
Does this code print out the contents of the file named `--help`, or does it print the documentation for the `cat` command?
filename = "--help" await sh(t"cat {filename}")
It's worth visiting this release page to see the adorable banner
No GIL, and JIT enabled (even if experimental), kudos to the team.
Python, I hate to love you.